Chapter 6: Boundaries and Friction

Overview

What well cover in this chapter:

  • Environmental boundaries

  • Friction

  • Important formulas in this chapter

Youve covered a lot of ground in the preceding chapters, so that you can now take any graphic, wrap it in a movie clip, and use all kinds of forces to move it around the screen. However, youve probably already run into a small annoyance with many of the examples youve created so far: When you move the object off the screen, bangits gone. Sometimes, if its moving fast at some angle, you have no way of knowing how to get it back. Your only option is to restart the movie.

In most real-world scenarios, some boundaries existsometimes walls and a ceiling, but at the very least, almost always the ground. Unless youre making a space simulator, you want to have some kind of environmental barriers to keep your objects in view. If you are doing the space thing, you need at least some way to keep your main objects in view.

Another thing you may or may not have noticed is how this environment, or lack thereof, fails to have any effect on the object as it moves. You start an object moving, and it just keeps on going in the direction its headed at the same speed, until you apply some other force. Actually, this isnt a bug at all, but the way the universe works. The term inertia is used to describe the fact that an object traveling through space will continue to travel at the direction and speed at which it is moving until some other force is applied. Or, to state it differently, its velocity wont change unless something changes it. In common experience, one of the things that changes an objects velocity is some sort of friction even if only the friction of air. So, while youve successfully simulated an object moving in a vacuum , you are probably itching to make it a little more like something in your everyday environment.

This chapter will cover both of these issues. First youll learn how to work with boundaries, and then how to mimic friction. Lets go.



Foundation ActionScript. Animation. Making Things Move
Foundation Actionscript 3.0 Animation: Making Things Move!
ISBN: 1590597915
EAN: 2147483647
Year: 2005
Pages: 137
Authors: Keith Peters

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net