Learn Create Your Own Split Screen

Next Page

Here's that code running. Drive the hero around and make sure it all works as it should.

Sometimes the hero might go a few pixels off-screen. This can happen because we're moving the hero 3 pixels at a time. So if, for example, it was 1 pixel away from being out of bounds, we'd let the next motion go ahead, resulting in it being 2 pixels out of bounds. If it really mattered, we could add another few if-statements to sort that out.

But this is good enough for now.