Foundation Actionscript 3.0 Animation: Making Things Move!

Basically, collision detection, or hit testing, is a very simple concept. You want to know if two objects are occupying any part of the same space at the same time. Of course, you may have a lot more than two objects, and you may want to know if any of them are hitting any others. But when you break it down, you need to test each object one at a time against each other object. So, it always comes down to testing one object against another.

As the title of this section indicates, you have a couple of ways of doing collision detection:

Each method has its uses. Ill cover both in detail in this chapter, and youll get a good chance to see how they are used.

One thing I wont go into in too much detail in this chapter is what to do when you do get a collision. How are two objects supposed to react when they bump into each other? Ill cover that subject in exhaustive detail in Chapter 11, when I talk about conservation of momentum.

Категории