Skip to content
Game 8 Unit 2 of 8 1 hr learning time

Thrust and Fuel

Hold SPACE to thrust against gravity — INKEY$ inside the loop gives real-time control — but every burn spends from a finite tank.

25% of Touchdown

Freefall is not a game — the player needs a way to fight gravity, and a reason not to fight it forever. This unit adds both: a thruster on the SPACE key, and a fuel tank that the thruster drains.

  10 BORDER 0: PAPER 0: INK 7: CLS
  90 CLS
 100 LET alt = 100
 110 LET spd = 0
 120 LET fuel = 50
 150 LET spd = spd + 1
 160 IF INKEY$ = " " AND fuel > 0 THEN LET spd = spd - 2: LET fuel = fuel - 1
 170 IF spd < 0 THEN LET spd = 0
 190 LET alt = alt - spd
 200 IF alt <= 0 THEN LET alt = 0
 210 PRINT "ALT: "; alt; "  SPD: "; spd; "  FUEL: "; fuel
 480 IF alt > 0 THEN GO TO 150
ALT/SPD/FUEL telemetry: the speed rises, then dips and falls while fuel counts down during a thrust burn
A sustained burn slows the fall — speed drops and fuel ticks down with every pass.

INKEY$ inside the loop

You met INKEY$ in Reflex as a real-time key read. Here it does the same job, but inside the continuous loop: line 160 — IF INKEY$ = " " AND fuel > 0 THEN ... — checks, on every single pass, whether SPACE is held down right now. No waiting, no pause. Gravity adds 1 to speed at line 150; if SPACE is down, the thruster subtracts 2 (line 160) and line 170 stops the speed going negative. Because thrust (−2) beats gravity (+1), holding SPACE doesn't just cancel the fall — it actively slows the lander. That is real-time control: the world keeps moving, and you nudge it as it goes.

A finite tank

The AND fuel > 0 on line 160 is what turns thrust into a decision. Each burn runs LET fuel = fuel - 1, so the tank empties as you use it — and once fuel hits 0, the condition fails and the thruster goes dead, gravity unopposed. Fifty units of fuel is not enough to hover all the way down; it is just enough to land if you spend it well. That scarcity is the whole game: not "can you stop falling" but "can you afford to stop falling at the right moment."

Next: a proper dashboard, and a verdict when you reach the ground.