I'm working on a 2D iPhone game using Corona (Trial version, so I can't use their forums). The game involves the character falling through the sky, and I'm trying to implement a "double jump" for the character, for him to be able jump up while falling. I'm using Corona's physics library to have the character fall, and so far the best method of having him jump is using the vertical impulse method

object:applyLinearImpulse(0, -0.4, object.x, object.y)

The problem I face is that when the character is just starting out (vertical velocity is low), he jumps really high, and when he's been falling for a while (vertical velocity is high), the jump is negligible. I'm guessing that the best solution is to use some sort of equation with the velocity as input to make the jump the same regardless of velocity, but I can't figure out what that equation would be.

Okay, so that's all my thoughts. The end question is, how exactly do you implement a double jump with physics? Is there a proper equation for my problem? Should I take a different approach? It's been done before in games like Smash Bros, so there's a repeatable solution, right?


2 Answers 2


Just set the vertical velocity to zero, and just call the same code you use to do the first jump.

  • 4
    \$\begingroup\$ Oh. That...actually works pretty well. And so simple that I now feel foolish for not thinking of it. Oh well. Thanks! \$\endgroup\$
    – Jesse J
    Commented May 20, 2011 at 3:49
  • 5
    \$\begingroup\$ It's often tempting to make things more complicated than they need to be :) \$\endgroup\$
    – Adam Harte
    Commented May 20, 2011 at 7:13
  • 2
    \$\begingroup\$ elegant answer! \$\endgroup\$
    – lathomas64
    Commented May 20, 2011 at 17:01

I'm not sure, but I think games like UT2K4 might use logic like this:
if (jumped already && !doubled jumped yet && !touching ground && velocity.up is approximately 0.0f) DoDoubleJump();

Where up is your y or z component (Depending on which one is up)
This means that your player can only do a double jump when they are at the maximum height of their first jump and are just about to start come down again.
I like this method because it creates a little bit of skill (You have to time it to happen inside of "velocity.up is approximately 0.0f").
Depending on what you want, you could bias "approximately 0.0f" towards positive numbers so they can only double jump when still moving up for example.


You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .