0 Favourites

How to do a charged up jump mechanic (think Spring Ninja)

  • Spring Ninja's spring mechanics is perhaps the best way to describe what I am aiming for. So, depending on how long a button is held down for, upon release, the object jumps at a certain angle to cover a certain amount of distance. So, a simple tap would just make the object hop slightly to the side (almost like a sidestep) whereas holding down for a second would charge up for a medium jump and any longer would charge up a larger leap. Again, the input only charges the jump. The actual jump action does not activate until the player has released the input. I was looking into Platform behaviour for this but now I'm thinking maybe Bullet behaviour would be more fitting (angle of motion and all).

  • Ok, I have an idea I'm going to try out but I'm stuck on one thing.

    Basically, I set a global variable known as Charge and have it where if the "C" key is held down a 1 is added to Charge every 0.2 seconds. The max for that charge will be 7, which would be reached in 1.4 seconds (I may change these timings depending on what feels good in terms of mechanics). Then, when "C" key is released, whatever value the Charge variable was at will be stored. What I do then is use that value to determine the length of the jump. So, if the value was between 0 and 1, a short hop to the right will be executed (x angle of motion). If over 1 but under 2, a slightly lengthier jump to the right is executed. And so on, with over 2 but under 3, etc, etc.

    Does that look good? If so, and this is where I'm stuck, how do I store the value of a global variable when the key is released?

  • Ok, I've attempted the above and it seems to work. What I'm stuck on now is making sure the motion of the object after it has jumped ends instantly when the object comes into contact with the ground again. Right now, the object is sliding (I'm using physics behaviour). I need to make sure that each of the seven jumps (activated depending on how long the key is held for) covers the same distance if repeated. Can anyone help?

    Just another thing to ask, would physics behaviour be apt for this? If I want the exact same distance covered if the player repeats jump #3 (hold button for half a second) then is there another behaviour that would give me that exactness?

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • have you tried it works, dude?

    I need help on that too.

  • Oh hello!

    Yes. It is not the most elegant of solutions but it does indeed work. Give me a sec, I will post it.

  • Now, change the values to get the sort of jump you like (in height or length) and how long it takes to charge, etc.


  • thank you!!! I will try it~

  • just tried it recently, and it's great dude!!!

    thank you very much!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)