(time)
| 18 | let speedScale |
| 19 | let score |
| 20 | function update(time) { |
| 21 | if (lastTime == null) { |
| 22 | lastTime = time |
| 23 | window.requestAnimationFrame(update) |
| 24 | return |
| 25 | } |
| 26 | const delta = time - lastTime |
| 27 | |
| 28 | updateGround(delta, speedScale) |
| 29 | updateDino(delta, speedScale) |
| 30 | updateCactus(delta, speedScale) |
| 31 | updateSpeedScale(delta) |
| 32 | updateScore(delta) |
| 33 | if (checkLose()) return handleLose() |
| 34 | |
| 35 | lastTime = time |
| 36 | window.requestAnimationFrame(update) |
| 37 | } |
| 38 | |
| 39 | function checkLose() { |
| 40 | const dinoRect = getDinoRect() |
nothing calls this directly
no test coverage detected