BGE Sprint/Long Jump as in Half Life 1?

Hi guys, I would like my player be able to jump as in half life 1 for example.
The question is how to sprint just for one time and not continue to run faster. I try with “tap” without good result.
Could someone help me?

if you want only one jump per key, activate tap and false level triggering, it is the second block with the three dots. this gives you one sensoraction per pressed key. but you will still be able to press the key while in air and give it another jump. if you dont want this to happen, you got to use a raysensor that checks if the player is at the ground or any object you gave the gameproberty ground. combine the keyboardsensor and the raysensor with an AND controller which is the usual controller and you will have a working jumporama.

the timed sprint you can do with a timer gameproberty. create a timer, name it sprint and set it to any value higher than the time you want sprint to happen.
you need a keyboardsensor like the jumpsensor. you can check the timer by using an expressioncontroller.
write into the expressionfield timer>100 (100 is the time the timer shall run. change it to your time)
and you need a probertyactuator that sets the timer to 0 or toggles it (same effect)
what does the combination do? it sets the timer to 0 one time for the time of 100 tics and after 100 tics another pressed key will do the same but not before the time is over

now you need a probertysensor that checks if the timer is less than 100 (again your time)
combine it with a and controller and a motionactuator with the force for extra speed
now what is happening here? the pressed key gives the timer the value 0 and the timer runs. as long as it is less than 100 the motinactuator will run with sprint speed. tada.

if you want a cooldown for the sprint it will be a little bit more complicated. you need another timer that starts the same time as the sprinttimer but lets say you check it when it reaches 200. so everytime it is over 200 the whole thing can happen.

when you press the key start a timerproberty. when the timer reaches the amount of time you want the sprint to happen

edit: example blend
press e for sprint and spacebar for jump.

i changed timervalues to 10 and 20 because these are seconds not tics


sprint and jump blend.blend (412 KB)

Thank’s a lot! I have recreate the HL superjump!