Workshop › Rhythm Lanes › Step 8 of 35
The game counts frames in frame. A note's height is worked out from how far away its time is: on the line exactly
at its time, and SPEED pixels higher for every frame still to go.
```js
const SPEED = 4 // pixels a note falls per frame
let frame
frame = 0
}
// Where a note is drawn: on the line at its time, higher up the earlier it is.
const noteY = (note) => HIT_Y - (note.time - frame) * SPEED
```frame counts frames; reset sets it to 0.note.time - frame is how many frames are left. Times SPEED it is the distance above the line.noteY is a one-line arrow function: it returns the value after =>.HIT_Y write SPEED.let notes write let frame.reset, write frame = 0.reset, after an empty line, write the comment and noteY.Skills: Game states
← From text to notes Draw the notes →