Skip to content

Let go and slow down

  • The Craft

Releasing a direction can mean “stop now” or “start slowing down”. Both ships now accelerate at the same rate; change only the rule used after release.

Both ships receive the same input. Changing the slider resets them. Open “Inspect one update” to pause and trace a single step. This is a browser model, not a measurement of a particular retro computer.

Movement rule source (JavaScript)

Compare the stopping point

Choose Run same input. Both ships receive Right for one second. They accelerate together at 600 units/s² and reach 240 units/s. Then the input becomes Released.

The reference stops immediately. Your ship approaches zero velocity using the braking setting. At the default 120 units/s², it takes two seconds to stop from 240 units/s. Halve the braking to 60 and it takes four seconds. This comparison does not alter acceleration while a direction is held.

Try releasing before the marker. A ship that keeps moving requires an earlier decision to stop. If it reaches a wall, the wall clamps its position and clears velocity, so reset before comparing an unobstructed stopping distance.

Release still has a target

Code
LET target = input * 240
IF input = 0 THEN
    LET rate = releaseBraking
ELSE
    LET rate = 600
END

We use the previous lesson’s approach rule to move velocity towards target by at most rate × elapsedSeconds. Released input makes the target zero; it does not necessarily make the current velocity zero.

At 240 units/s with braking of 120 units/s², one 1/60-second update removes 2 units/s. The new velocity is 238, and the ship still travels 238/60, about 3.967 units, during that update. Open the inspector to trace the same calculation after accelerating.

The ship is moving left at −60 units/s. After release, the update permits a change of 2 units/s. Should velocity become −62 or −58?

Show the explanation

−58. Braking approaches zero from either direction. Subtracting 2 regardless of the sign would make a left-moving ship faster instead of slowing it down.

Momentum changes the task

A longer stopping distance can make docking or steering interesting. It can also make precise placement harder. Decide whether predicting that motion belongs to the intended challenge, and make the motion readable enough for the player to learn it.

This experiment applies a chosen braking rate. It does not simulate mass, drag or a real engine. Calling a preset “slippery” describes the experience; the rate and update rule explain how we produced it.

Holding the opposite direction is a different request from releasing. The next lesson separates those two cases.