Workshop › Endless Runner › Step 13 of 19
The world speeds up a little every frame, up to twice its starting speed. We also add up the distance run, which will become the score.
```js
let distance
distance = 0
distance += speed
speed = Math.min(12, speed + 0.003)
```distance grows by the speed every frame: the pixels the world has moved.speed + 0.003 each frame is +0.18 a second; Math.min(12, ...) stops it at 12.let speed, write let distance; in reset, under speed = 6, write distance = 0.update, under the ground block, write the two lines.Skills: Game states
← Try again Remember the best run →