The value of object variables in ActionScript.
The previous code for Ball.as could be modified to make the ball bounce off of any wall on any size stage. But you must manually go in and change the code if either the ball or stage is a different size than originally set.
Isn't there a better way to make a more general solution that would work for:
|Any Movie Clip object on the stage has the properties:||The stage itself has the properties:|
How can these be used to create a script that will make a ball of any size bounce off the edges of a stage of any size?
The ball bounces when:
Try changing the code for the Ball class and run the scene with a variety of balls of different sizes.
Note: If you use Ctrl-Enter to test the movie you MUST resize the test window (hit the resize icon at the top right of the screen before you play the movie, then Ctrl-Enter) otherwise the "stage" size will be calculated as the test window size (which includes areas out of view)
The ball speeds up if it hits the top and slows if it hits the bottom wall (Hint: use a variable to control the distance moved)
Think of a variation of your own!