Learn Create Your Own Split Screen

Next Page

We already have some fruit and obstacles appearing outside the visible portion of the canvas, and we can drive the spider outside the visible region.

The canvas extends (almost) an infinite distance in all directions, because it's possible for us to imagine x and y coordinates bigger than the actual size of the canvas.

So we have the idea of the visible canvas being "viewport" into a much bigger (almost infinite) canvas.

To make a scroller, we just need to move the viewport around.

To make a nice scroller, we let the hero wander around the canvas, but when it gets close to an edge, as well as moving the hero we also move the viewport.