• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Chapter 5. Collision Detection > Points to Remember

Points to Remember

  • A collision occurs when two separate shapes share one or more points in space.

  • In Flash you can use two main types of programmatic collision detection: hitTest() and math.

  • Using math is considered the superior method of collision detection because in addition to confirming detections in the present, you may also be able to use it to determine the future time and location of a collision.

  • Limitations of hitTest() include its limited abilities with complex shapes, its close relationship to specific graphics or movie clips, and its dependence on frame rates.

  • Code-graphics independence is a liberating method of working with movie clips. It uses objects to store information about each movie clip. Storing information in an object—separate from its actual interface element—is a good practice because it allows you to add or remove movie clips from the stage without losing the data.

  • You can use the Linkage feature to enable ActionScript to create an unlimited number of new instances of any kind of symbol (not just movie clips) in the Flash file's library.

  • Loops are an immeasurably helpful tool to use with ActionScript, especially when your work involves performing identical tasks on a number of elements such as movie clips.

  • Using math for collision detection also allows you to work with irregular shapes, write frame-independent collision-detection scripts, and handle all of the code in memory, rather than basing it on the placement of the graphics.

  • The frame-independent collision-detection logic (and scripts) that you've learned here can be applied to the creation of any other simple or complicated shapes by breaking them down into lines.



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint