Workshop › Flappy-style Bird › Step 10 of 30
Right now the bird falls the moment the page loads. A game has phases: 'ready' (waiting), 'playing' and later
'over'. One variable, state, says which one we are in; nothing moves until the first flap.
```js
let state = 'ready' // 'ready', 'playing' or 'over'
function flap() {
state = 'playing'
bird.vy = FLAP
}
function update() {
if (state !== 'playing') return
```state starts as 'ready'.'playing'.update returns at once unless we are playing: !== means "is not equal to", return leaves the function.bird line, write the state line.flap, add state = 'playing' above bird.vy = FLAP.update, add the if line at the very top.Skills: Game states
← Space, Up arrow or a tap The ground and the sky →