Workshop › Frogger-style Crossing › Step 15 of 22

Ride the log

What we are doing

A frog on a log moves with it. If the log carries it past the edge of the screen, that is a splash too.

```js
// The log carries the frog; being carried off the screen is a splash too.
frog.x += lane.speed
if (frog.x < -0.5 || frog.x > COLS - 0.5) die()
```

What it means

Your turn

In update, under the log check, write the comment and the two lines.

Skills: Velocity and gravity

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