Screen Wrap a Moving Object

Create Variables

That's awesome! The next thing we should do is get those hard numbers out of the if statement and turned into variables. Let's declare top and bottom boundaries at the start of our script:

Now utilize those variables in the if statement:

Test again to make sure you haven't made any typos:

Content on this page requires a newer version of Adobe Flash Player.

Get Adobe Flash player