Workshop › Rhythm Lanes › Step 21 of 35
"Hit" is not enough: players want to know how well they hit. Within PERFECT (4) frames it is Perfect, within
GOOD (9) it is Good.
```js
const PERFECT = 4 // frames either side of the exact moment
closest.hit = true
if (off <= PERFECT) {
judge('Perfect', '#fde047')
} else {
judge('Good', '#86efac')
}
}
```<= means "less than or equal".if (...) { ... } else { ... } runs the first block when the condition is true, otherwise the else block. We only
get here when off is at most GOOD, so else covers 5 to 9 frames.const GOOD = 9 write PERFECT.press, replace the judge('Hit', ...) line with the if ... else block.Skills: Game states
← Let the message go Keep count →