Skip to content

12 / Jumping

Variable jump height

tap for a hop, hold for the full jump

The longer jump is held, the higher the character goes. Letting go while still rising cuts the upward speed, so a quick tap gives a small hop and a full hold gives the whole arc, all from one button. The runner alternates a tap and a hold; switch the technique off and both come out the same height. Hold Jump to try it.

Use it for
  • Platformers that need precise jumps
  • A single jump button that has to cover both small steps and big gaps

Hold Jump, or press and hold on the scene, for a high jump; tap it for a low one. If the scripted runner has already pressed, or a round has just ended, your first press starts a fresh round for you.

Prompts to paste

Prompt line

Make jump height depend on how long jump is held: if the button is released while the character is still rising, multiply its upward velocity by 0.5 one time. A tap then gives a low hop and a hold the full jump; falling speed is never touched.

Full prompt

Add variable jump height to the player's jump. When the jump button is released and the vertical velocity is still upward, multiply it once by a tunable releaseKeep of 0.5, not every frame, so a tap produces a short hop and holding produces the full jump. Leave the velocity alone if the character is already falling. Optionally raise gravity 1.5–2× while falling so jumps don't feel floaty, and keep the full-height jump the same as it is now.

Examples

Two ways to do it

Cutting upward speed on release and increasing gravity while the button is up both work; the cut is easier to tune.

Faster falls

Many platformers also fall faster than they rise, so jumps feel snappy instead of floaty.

Keep a minimum hop

Make sure even the shortest tap still clears a small step.

Pitfalls

Repeating the cut each frame

Multiplying velocity on every frame the button is up ties the result to the frame rate. Cut once, at release.

Cutting a fall

Reducing a downward velocity slows the descent and makes landings feel floaty.

An over-strong cut

Keep too little speed and a tap barely leaves the ground, which feels like a stumble.

Starting values

SettingValueNote
Speed kept on release30–60%
Fall gravity1.5–2.5× the rising gravity