Wrap Multiple Objects

Wrap with an if statement

...and just like before, we'll reset the Y position of each ball when it hits the bottom boundary. Let's do a quick statement setting the Y position to 100 whenever Y is greater than 250:

Now test it:

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

Get Adobe Flash player

We'll move those hard numbers out of the if statement and into variables right now. Create boundaryTop and boundaryBottom variables, and use them in the if statement:

ABT... Always Be Testing, because the smallest typo will bring your project to a standstill:

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

Get Adobe Flash player