← All posts

Making a tiny alien feel good

Coyote time, jump buffering, a dash with one air charge and ledge grabs: the numbers behind Pew's movement.

Listen to this post

Read in Dodz's voice, cloned with AI

0:00 / 0:00
Pew jumping across a gutter pool in the Godot prototype.

In a run and gun you spend the whole game moving. If the movement feels mushy, nothing else matters. So the next step was the player controller, tested in an ugly grey room before going anywhere near the pretty art.

The movement test room. Grey boxes, because the point is how it feels, not how it looks.

The numbers

Pew is a CharacterBody2D with a small state machine: idle, run, crouch, jump, fall, dash, hanging on a ledge and climbing it. Every value is exported in groups, so I tune from the editor instead of hunting for constants. These are the current ones, in pixels and seconds on a 1080p screen:

WhatValue
Run speed460 px/s
Ground acceleration / friction3600 / 4200 px/s²
Air acceleration2600 px/s²
Jump speed1340 px/s
Gravity going up / coming down2800 / 4200 px/s²
Max fall speed1500 px/s
Jump cut on release× 0.45
Coyote time0.1 s
Jump buffer0.12 s
Dash1150 px/s for 0.16 s, 0.35 s cooldown

Small lies that feel fair

Most of what makes a platformer feel good is the game quietly helping you:

  • Coyote time. For 0.1 s after running off a ledge, a jump still counts. Your eyes say you were on the edge; the game agrees.
  • Jump buffer. Press jump up to 0.12 s before landing and Pew jumps the moment he touches the ground, instead of ignoring the press.
  • Variable height. Let go of jump while rising and the upward speed is cut to 45%. Tap for a hop, hold for a full jump.
  • Heavier falls. Gravity is stronger coming down than going up, so jumps feel snappy instead of floaty.
  • One air dash. The dash works on the ground with a cooldown, and once in the air until you land. Pew is invulnerable while dashing, which will matter once things start biting.
  • Ledge grab. Falling next to a wall while holding toward it, Pew grabs the edge and can climb up. There's no hanging sprite yet, so for now he borrows the aim-up pose.

On top of that, a bit of squash and stretch when he jumps and lands, a puff of dust, and afterimages during the dash.

A camera that looks ahead

The camera lives outside the player. It follows Pew smoothly and leans in the direction he's facing, so you see more of what's coming than what's behind. Keeping it separate also means it can follow something else later without touching Pew.

Tests that press the keys

The test room is built from two lists of rectangles, so what you see and what you collide with always match. F3 shows the current state and speed.

There's also a headless test scene that simulates key presses and checks the results: a full jump goes higher than a short one, the dash covers distance, crouching works, Pew grabs a ledge. It runs without a window in a couple of seconds, which means every change to the controller gets checked, including the changes made with an AI helping on the code.

Next: giving Pew something to do with his hands, in eight directions.