Hi, im trying to make a space invaders game and am stuck moving my gun. Ive put a loop in that moves the ship to the right when a button is pressed and then should stop when released. the stop part doesnt work. can anyone help! here is the code.
Private Sub CmdRight_MouseDown(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
Do Until LblBullet.Left = 324
For i = 1 To 5000
DoEvents
Next i
Dim MyVar As Variant
MyVar = f
If MyVar = t Then
ImgGun.Left = ImgGun.Left + 1
LblBullet.Left = LblBullet.Left + 1
Else: Exit Do
End If
Loop
End Sub
Private Sub CmdRight_MouseUp(ByVal Button As Integer, ByVal Shift As Integer, ByVal X As Single, ByVal Y As Single)
MyVar = f
End Sub
have i just got my variable or if statements in the wrong place
