Workshop › Frogger-style Crossing › Step 16 of 22
Riding a log leaves the frog between squares. When it hops onto solid ground or the road, it snaps back to the nearest square, so the grid stays tidy.
```js
const lane = laneAt(frog.y)
// Back on solid ground: line up with the grid again.
if (!lane || !lane.log) frog.x = Math.round(frog.x)
```Math.round snaps the column to a
whole square.At the end of hop, write the three lines.
Skills: Game states