Jump Routine

Blitz3D Forums/Blitz3D Programming/Jump Routine

Here's a very simple way of doing a "jump" I'm not that good at physics... hehe.
Graphics3D 640, 480, 0, 2

cam = CreateCamera()
cube = CreateCube()
MoveEntity cube, 0, 0, 10

gravity# = .2
jumpforce# = gravity# *2.5

Repeat
	
	If KeyHit(57) Then jump = True
	If jump = True Then
		i = i + 1
		If i = 30 Then jump=False : i = 0
	EndIf
	
	If jump = True Then
		MoveEntity cube, 0, jumpforce#-gravity#, 0
	Else
		MoveEntity cube, 0, -gravity, 0
	EndIf
	
	
	If EntityY(cube) <0 Then PositionEntity cube, 0, 0, 10

	RenderWorld
	Text 0, 0, i
	Text 0, 20, jump
	Flip
Until KeyHit(1)
End