Results 1 to 3 of 3

Thread: Threading

  1. #1

    Thread Starter
    New Member
    Join Date
    May 2013
    Posts
    1

    Threading

    My first post, so apologies for any confusion I bestow.

    I'm new to Visual Basic (2010), but not to coding. My problem is, I have a game I want to make with controls, but I know of no way to allow the form to change and run code while the player controls. I figure multi-threading would do it, or more experienced programmers know a better way. My current events/code:

    Private Sub beginButtonClicked(ByVal sender As Object, ByVal e As System.EventArgs) Handles BeginButton.Click
    'Many loops and game-running code
    End Sub

    Private Sub directionKeyPressed(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles MyBase.KeyPress
    'Very short control functionality code
    End Sub

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Threading

    What you really want is called a game loop. Its not a simple enough topic for me to really cover in this post so I suggest you look up the term on Google and gather ideas about what other people are doing. You can use multi-threading but Timers can also be used.

    Here is an article to start you off. Note however that it doesn't cover game loops exclusively but other issues involved in game development in VB.Net as well. Take a good read and as I've said earlier, look up other articles on the topic so you have a firm idea of what directions you need to take with this.
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,106

    Re: Threading

    You might also find this thread of interest:

    http://www.vbforums.com/showthread.p...hics-in-VB-Net
    My usual boring signature: Nothing

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width