|
-
Dec 17th, 2001, 11:10 AM
#1
Thread Starter
Frenzied Member
Speed problems...
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
-
Dec 17th, 2001, 11:37 AM
#2
Frenzied Member
Post the project in a zip
-
Dec 17th, 2001, 11:40 AM
#3
Thread Starter
Frenzied Member
-
Dec 17th, 2001, 05:37 PM
#4
Frenzied Member
-
Dec 18th, 2001, 10:14 AM
#5
Thread Starter
Frenzied Member
Ok Thanks
-
Dec 18th, 2001, 01:59 PM
#6
Frenzied Member
You're welcome
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|