Workshop › Lunar Lander › Step 10 of 31
A lander that leaves one side of the screen comes back on the other. The remainder operator % does it in one line.
```js
// Leaving one side brings the lander back on the other.
lander.x = (lander.x + canvas.width) % canvas.width
```% gives the remainder: 490 % 480 is 10.(-3 + 480) % 480 is 477.In update, under lander.y += lander.vy, write the comment and the new line.
Skills: Velocity and gravity
← Moon gravity Flying or not →