Jumping

Blitz3D Forums/Blitz3D Beginners Area/Jumping

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

OK so I am still experimenting with a jump command... I did this in my game to move the dude up when the spacebar is pressed... only problem is if you hit the spacebar repeatedly you jump like the hulk (up and up and up but not away!)

So I thought I would create an instance that you couldn't jump for a few seconds after the first spacebar press... you know to limit the jumpage... I did this:

If KeyDown( 205 )=True Then RotateEntity camera,0,-5,0
If KeyDown( 203 )=True Then RotateEntity camera,0,+5,0
If KeyDown( 208 )=True Then MoveEntity camera,0,0,-5
If KeyDown( 200 )=True Then MoveEntity camera,0,0,5
If KeyHit(57)=True And jumpflag = False Then For jasc=1 To 90 
	TranslateEntity camera,+0,+1,+0
	Next
	For jasc=90 To 1
	MoveEntity camera,0,-1,0
	Next
	oldtime=MilliSecs()
	If MilliSecs()< oldtime + 5000 Then jumpflag=True Else jumpflag = False

x#=EntityX(camera)
y#=EntityY(camera)
z#=EntityZ(camera)


; ---- HOW TO USE GRAVITY

y#=y#-8

; ------------------

;If EntityCollided (castle,2)
;y#=y#+40
;ElseIf EntityCollided (terrain,2)
;y#=y#
;EndIf

; If y#<49 Then y#=49
; ------------------------



PositionEntity camera,x#,y#,z#
But it doesn't work. I set the flag jumpflag to 0 before starting the main program loop. I also plonked a bit after render that would show me the status of jumpflag... it stays at 1 all the time... 1 is true isn't it. Where does my logic fail?

Keeping in mind that I am not an exteremely logical person!
-RZ