double jump?

hey all,

i’ve been trying to figure out a way to make my character do a double jump but i couldn’t do it.:frowning: Im currently learing python but i cant create a double jump script.

any know of any tutorials?

thnx

If you know how to do one jump, this should be pretty easy.

My recommendation: Use states.

In the attached file, I have one state for being on the ground, one state for being in the air with a double jump available, and one final state with no double jump available.

I use the “Tap” option of the keyboard sensor to make sure that my motion actuator only activates once.

I use Servo for the jump because… it’s easy :).

You can also easily do this with properties if you don’t want to mess with states. Set a property called “jumped” or something, have it be 0 while on the ground, 1 when you’re in the air, and only 2 when you’ve jumped again in the air. Use property sensors or expression controllers to make it so that you can only “double jump” if the property is 0 or 1, and have that double-jump set the property to 2. When you hit the ground again, you can reset that property to 0.

-Sam

Attachments

doublejumpstates.blend (33.5 KB)