Workshop › Pinball › Step 19 of 42
Bumpers will give points, so we need a score. A new game sets it to 0: reset() sets up everything a game starts
with, and it runs once when the page loads.
```js
let score
function reset() {
score = 0
newBall()
}
reset()
requestAnimationFrame(loop)
```score is declared empty; reset gives it its starting value.reset() also makes the first ball, so it replaces the newBall() call at the bottom.let state write let score.newBall write reset.newBall() with reset().Skills: Game states, Functions
← A bumper kicks Points for every hit →