Robot Foot Games Helping you improve your games as we improve our own. :)

30May/110

Double Jump in PSK

Double jumping is pretty common in most platformers so I thought I'd share some code I use for it.

Here's a video showing the final product:

In Player.cs add the following underneath the other jumping code. (MaxJumpTime, JumpControlPower, etc.)

 

Now find this line in Update(...)

and add this after it:

 

Now in the DoJump(...) method find this block of code

and change it to this:

 

And that's it! You're able to double jump slightly after the first jump and whenever you're on the ground your jump count gets reset so you're able to double jump again.

 

Comments (0) Trackbacks (0)

No comments yet.


Leave a comment

(required)

No trackbacks yet.