Workshop › OutRun-style Racer › Step 6 of 44
How far the car has driven is a single number, position. A reset function puts the game at the start: it builds
the track and sets position to 0. Later a new race will call the same function.
```js
let position // how far along the track the camera is
function reset() {
buildTrack()
position = 0
}
reset()
```position is the distance the camera has come along the track.reset builds the track and puts the camera at the start. The call at the bottom now uses reset().let trackLength write let position.buildTrack, after an empty line, write reset.buildTrack() call at the bottom to reset().Skills: Game states
← A road made of segments The road ahead →