Hey guys!
I'm making a lander game, byt I cant get the speed right when i try to slow the ship down, and when it falls....I have tried looking at the lander game here from VB world, but I couldn't figure it out...
VB Code:
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




Reply With Quote