i am making a game where you use the left and right arrow keys to move a little guy left and right on the screen and i have used this code:
VB Code:
Private Sub Form_KeyDown(KeyCode As Integer, Shift As Integer) If KeyCode = vbKeyLeft Then x = x - 100 Elseif keycode = vbkeyright then x = x + 100 end if End Sub
that moves him left and right but the only thing is that when i hold down the key, he moves forwards for a fraction of a second, stops then starts moving normally until i let go. does anyone know how to just make it start moving normally as soon as i press the key?
also if i have any text boxes or buttons on my form then this code doesn't work, how do i get it to work while it has buttons and text boxes on it?




Reply With Quote