Workshop › Breakout › Step 22 of 39
While serving, the ball sits on the paddle wherever it goes. At the top of update, we keep the ball on the paddle's
middle and stop there.
```js
if (state === 'serve') {
ball.x = paddle.x + PADDLE_W / 2
return
}
```=== asks "is it exactly equal?". While serving, the ball's x follows the paddle's middle.return leaves the function at once, so the rest of update does not run.Write the if at the very top of update, right under function update() {, followed by an empty line.
Skills: Game states
← Wait on the paddle Launch the ball →