Workshop › Pinball › Step 9 of 42
A pinball table is tilted towards you, so the ball is always pulled down a little. Each frame, gravity adds a bit to
vy.
```js
const GRAVITY = 0.12 // the table is tilted towards you
function update() {
ball.vy += GRAVITY
ball.x += ball.vx
ball.y += ball.vy
}
```GRAVITY is how much downward speed the ball gains each frame.ball.vy += GRAVITY comes first in update: first the speed changes, then the ball moves.const R = 8 write GRAVITY.ball.vy += GRAVITY the first line of update.Skills: Velocity and gravity
← Launch with Space Does the ball touch a wall? →