Workshop › Lunar Lander › Step 11 of 31
The lander is either flying or already on the ground. A state variable says which, and update does nothing unless
flying.
```js
let state // 'flying', 'landed' or 'crashed'
state = 'flying'
if (state !== 'flying') return
```reset starts every flight in the 'flying' state.!== means "is not equal"; return leaves update at once, so nothing moves.let gravity write let state with its comment.reset, under gravity = 0.025, write state = 'flying'.update, write the if as the first line, followed by an empty line.Skills: Game states
← Around the sides Touching the ground →