Jumping in game

Blitz3D Forums/Blitz3D Beginners Area/Jumping in game

NerdyBrendan(Posted 2010) [#1]
Hi... I'm making a first person shooter and I was wondering how I could make the character jump if a key(spacebar) is hit.

Thanks,
nerdybrendan


Ross C(Posted 2010) [#2]
Look at the keydown command and MoveEntity. Just use them in combination and keep track of when your player lands, so you can enable the jumping again.


Guy Fawkes(Posted 2010) [#3]
try using the codesearch tool to look for it. im not sure where it is as i downloaded it a few weeks ago, but it's an AWESOME tool! it helped me find code in the code database that i never knew EXISTED! :)


_PJ_(Posted 2010) [#4]
Spacebar has a 'scancode' of 57,
so:

KeyHit(57)

or KeyDown(57) will return True for differing sues of the Spacebar:

KeyHit returns how many times the spacebar has been it since the KeyHit was last called (unless FlushKeys was called meanwhile)

KeyDown returns True if the Spacebar is currently held down. (be careful, since frames are faster than the average keypress, so your program will react to x milliseconds worth of holding down Space.)

MoveEntity Entity,Sidewards,JumpHeight,Forwards