Wrap Multiple Objects

Review

Hopefully, you are starting to see the power of if statements, for loops, Event Listeners, and arrays as we continue our ActionScript practice. If you think about it, we didn't tackle any new major concepts in this exercise. Rather, we combined the skills we've learned thus far to produce something far more complex than we had when we started.

What We Did

  1. Created a new file called balls_wrap
  2. Created a moveBall function
  3. Created an ENTER_FRAME event listener that calls moveBall
  4. Screen-wrapped moving balls with if and else if statements
  5. Randomized the Y position of the balls to be anywhere on the vertical stage

Important ActionScript

myBall.y = Math.random()*boundaryBottom;