Workshop › Frogger-style Crossing › Step 19 of 22

Points for progress

What we are doing

Every row a frog reaches for the first time is worth 10 points, and a home 50 more. Hopping back and forth on the same rows earns nothing.

```js
let score
let furthest // the highest row (smallest number) this frog has reached

  furthest = START_ROW
  score = 0

  if (frog.y < furthest) {
    furthest = frog.y
    score += 10
  }

  score += 50

  ctx.textAlign = 'left'
  ctx.fillText('Score: ' + score, 10, 27)
```

What it means

Your turn

  1. Under let filled, write score and furthest; set furthest in newFrog and score in reset.
  2. In hop, before the home check, give points for new rows; in reachHome, add 50.
  3. In draw, write the score on the left.

Skills: Game states

All steps

  1. Road and river
  2. The frog
  3. Keep drawing
  4. Hop
  5. Swipe to hop
  6. Lanes of traffic
  7. Cars
  8. Traffic moves
  9. Hit by a car
  10. Three lives
  11. Play again
  12. Tap to play again
  13. Logs on the river
  14. Stay on the logs
  15. Ride the log
  16. Back in line
  17. Home slots
  18. Get home
  19. Points for progress
  20. Next level
  21. Best score
  22. Build it yourself: a time limit