The numbers behind a one-button wall jump
We made a small browser game called Wall Jump Tower. You press one button. Your climber jumps from one wall to the other while lava rises under you. It runs in the browser with no sign-up: https://thumbyard.com/go/wjt-de
We made a small browser game called Wall Jump Tower. You press one button. Your climber jumps from one wall to the
other while lava rises under you. It runs in the browser with no sign-up:
https://thumbyard.com/go/wjt-devto
With one button there is nothing to hide behind. If the jump feels a little off, the player has no other input to
blame, so the jump is the whole game. Before we tuned anything we studied
Celeste, Super Meat Boy, N++, Mega Man X and Hollow Knight, and wrote down every constant we could trace to a source.
This post is what we kept, with our real values.
Gravity is three numbers, not one
Our climber launches at 610 px/s. Gravity depends on what the player is doing:
p.vy += (p.vy > 0 ? 2000 : inp.hold && p.vy > -90 ? 800 : 1500) * dt;
if (p.vy > 900) p.vy = 900;
- Rising: 1500 px/s^2.
- Falling: 2000 px/s^2. A heavier fall makes the arc feel snappy instead of floaty.
- Near the top of the arc while the button is held: 800. That gives a short hang where you can read the next wall.
Celeste does the same thing with its
HalfGravThreshold(half gravity while jump is held and vertical speed is under 40 px/s). - Fall speed caps at 900 px/s, so a long drop stays readable on a phone screen.
Physics at a fixed 120 steps a second
If physics steps once per drawn frame, a 60 Hz laptop and a 120 Hz phone give different jumps for the same
tap, and a one-button game cannot afford that. Our physics runs at a fixed 1/120 s step from an accumulator, whatever
the screen does. A run is just the list of steps where the button went down, so it replays the same on any screen.
That is what makes the ghost of your best run, and challenge links to a friend, possible.
A 0.14 s grip before the wall slide
When the climber touches a wall in the air it sticks for 0.14 s before it starts to slide (slides cap at 70 px/s).
Without the grip, a tap that lands a hair late finds the climber already sliding away and the kick looks weak. With it,
late taps still feel like clean kicks. Ice walls skip the grip on purpose.
Small helpers the player never sees
- Corner correction: if the head clips the corner of a ledge by a few pixels on the way up, we nudge the climber sideways instead of killing the jump.
- Ledge pull-up: a jump that ends with the feet just under a ledge lifts onto it.
- The lava waits for your first press, so reading the level is free.
When a one-button puzzle feels pixel perfect
Level 9 has two circles that throw you upward. A playtester got stuck there and said it felt pixel perfect. We measured
the tap window with a script that tries every press time: the first circle gave an average of 113 ms. The fix did not
touch the jump numbers. A held press now fires a circle as you pass through it, and a press just before a circle waits
for it instead of spending your air jump. The window went to 182 ms, and one held press from the floor now carries
through both circles.
Animation follows physics, never the other way
Every clip is timed in milliseconds, not display frames, so 60 Hz and 120 Hz look the same. A turn takes 100 ms, as in
Hollow Knight, and a wall kick 167 ms (four frames at Hollow Knight's 24 fps wall-jump rate), and no animation ever delays a jump: physics decides,
the sprite catches up.
That is most of it. The game has 15 short levels, and every level keeps a ghost of your best
run. If you try it, we would like to know which level stopped you first:
https://thumbyard.com/go/wjt-devto
Made by Thumbyard.
Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.