Workshop › Doodle Jump-style Climber › Step 7 of 24
While the player crosses an edge, part of it is off the canvas. Drawing it a second time, shifted by the canvas width, shows that part on the other side.
```js
// Half off one side: draw the other half on the far side.
if (player.x < 0) ctx.fillRect(player.x + canvas.width, player.y, player.w, player.h)
if (player.x + player.w > canvas.width) ctx.fillRect(player.x - canvas.width, player.y, player.w, player.h)
```x < 0): draw a copy one canvas width to the right; sticking out on the right: to the left.In draw, under the player's fillRect, write the comment and the two lines.
Skills: Drawing on a canvas
← Through the sides Touch steering →