I am currently working on a maze game in Visual Basic 2010 Express. I am currently working on the keyboard controls for the character within the maze. I have succeeded...somewhat. I can get the Picturebox object to move using the following code:
Private Sub Lvl1_KeyDown(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles Me.KeyDown
Select e.KeyCode
Case Keys.W
Player.Location = New Point(Player.Location.X, Player.Location.Y - 2)
Case Keys.S
Player.Location = New Point(Player.Location.X, Player.Location.Y + 2)
Case Keys.D
Player.Location = New Point(Player.Location.X + 2, Player.Location.Y)
Case Keys.A
Player.Location = New Point(Player.Location.X - 2, Player.Location.Y)
End Select
End Sub
With that being said, I am not very satisfied with the results. When I run the application, the Picturebox moves very slowly and verrrryyyy jerky. On top of that, it can't move in diagonal directions. I think this makes for a very unpractical game, since the user will probably become extremely bored with the slug-like pace of movement. Is there any way to simply program a Picturebox to move quickly by 2-pixel increments and smoothly (i.e. no delay before changing directions)? Thanks!