GetAsyncKeyState problem *resolved*
I am working on the game pong. I cannont get my paddle to move up and down. I think there is more than one problem with my code, but I know that I must be using GetAsyncKeyState incorrectly because it doesn't change the values. Here is my code.
VB Code:
Private Sub Main()
lngTick = GetTickCount
Do While blnGameLoop
lstTick = GetTickCount
If lstTick - lngTick >= 50 Then
movepaddle
BitBlt frmPong.hDC, 0, 0, Picture1.Width, Picture1.Height, Picture1.hDC, 0, 0, SRCCOPY
BitBlt frmPong.hDC, x, y, 32, 89, Picture2.hDC, 34, 0 ,SRCAND
BitBlt frmPong.hDC, x, y, 33, 89, Picture2.hDC, 0, 0, SRCPAINT
DoEvents
lngTick = GetTickCount
End If
Loop
End Sub
Private Sub movepaddle()
If (GetAsyncKeyState(vbKeyUp)) = True Then
y = y - 10
End If
If (GetAsyncKeyState(vbKeyDown)) = True Then
y = y + 10
End If
End Sub