Workshop › Flappy-style Bird › Step 8 of 30
A flap does not push the bird up by some pixels: it sets its velocity to a fixed upward speed, -8. Gravity does
the rest.
```js
const FLAP = -8 // the bird's speed right after a flap (negative = up)
function flap() {
bird.vy = FLAP
}
```FLAP is negative because y grows downwards: going up means y gets smaller.bird.vy = FLAP sets the speed. With += a flap while falling fast would barely help, and two flaps would
launch the bird into space. Setting it makes every flap feel the same.GRAVITY line, write the FLAP line.bird line, leave an empty line and write flap. Press Run.Skills: Velocity and gravity
← Gravity Space, Up arrow or a tap →