Workshop › Lunar Lander › Step 17 of 31
Fuel makes every burn a decision. The tank holds 400; each frame of engine uses 1, and an empty tank stops the engine.
```js
lander = { x: 60, y: 40, vx: 1, vy: 0, angle: 0, fuel: 400 }
return state === 'flying' && keys.ArrowUp && lander.fuel > 0
lander.fuel -= 1
```fuel: 400.burning() also needs fuel left, so an empty tank means no push and no flame.reset, add fuel: 400 to the lander.burning, add && lander.fuel > 0.update, inside the if (burning()) block, write lander.fuel -= 1 at the end.Skills: Game states
← A flickering flame Touch controls →