Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
Dim Speed As Single
Dim Direction As Integer
Private Sub Timer1_Timer()
If (Picture1.Left > LandingPad.Left - Picture1.Width - Picture1.Height) And ((Picture1.Top _
> LandingPad.Top - Picture1.Height) And Picture1.Top < Picture1.Top + Picture1.Height) Then
Timer1.Enabled = False
If Speed > 1 Then
Print "Ship crashed!"
Else
Print "Ship saved!"
End If
End If
If GetAsyncKeyState(vbKeyLeft) Then
Picture1.Left = Picture1.Left - 20
End If
If GetAsyncKeyState(vbKeyRight) Then
Picture1.Left = Picture1.Left + 20
End If
If GetAsyncKeyState(vbKeyUp) Then
Speed = Speed - 1.5 / 60
Me.Caption = Speed
Direction = Direction - 20
Picture1.Top = Direction
ElseIf Not GetAsyncKeyState(vbKeyUp) Then
If Speed >= 15 Then
Speed = 15
End If
Speed = Speed + 1.5 / 60
Me.Caption = Speed
Direction = Direction + 40
Picture1.Top = Direction
End If
End Sub