Bounce Multiple Objects
Wrap and Review
You should be able to take the skills you've picked up in the past ten lessons to create a fun project! You're most important task right now is to start experimenting with some of the variables and challenge yourself to really master this stuff. Perhaps you could alter myBall.speed by setting incorporating a maxSpeed and minSpeed variable.
We have a great foundation now, but there's much more to learn. Maybe it's a bit like Algebra after all.
What We Did
- Opened with the file balls_wrap
- Created the file balls_bounce
- Created a variable called speed stored in each copy of myBall: myBall.speed
- Pulled the 5 out of our for statements and replaced with a variable called count
Important ActionScript
myBall.speed = (Math.random()*5)+5;
Self-Check for Understanding
What range of values would the following code produce for the variable enemy.speed:
enemy.speed = (Math.random()*11)+10;
Answer --> From 10 to 20 <--