Chapter 13. Detecting Collisions


What You Will Learn

In this lesson you will

  • Learn about collision detection and how to implement it

  • Use the sprite.intersects command to test for collisions

  • Create and use a film loop to make ships explode

  • Use the getPixel method to test for collisions

  • Add the final bonus level to the game

Approximate Time

This lesson should take you about 2 hours to complete.

Lesson Files

Media Files:

blowUp1.png

blowUp2.png

blowUp3.png

boom.aif

fire.aif

gameOver.png

tunnel.png

Starting Files:

snake!.dir

2d_game_start.dir

Completed Files:

2d_game.dir

This is the third lesson in the third project, an old-style 2D Space Shooter. In this lesson you'll really bring the game to life by implementing collision detection for your bullets and ship, as well as adding a fourth, bonus level where the ship must be navigated through a narrow passage.

Navigating through the passage

Collision detection is simply a means of knowing if one object is touching, or colliding with, another. Though primitive, the popular 1972 game Pong was one of the earliest examples of collision detection in a game. Today, much more advanced gamesand much more advanced collision algorithmsare being created. In fact, there are a good number of books dedicated strictly to the subject of collision detection. Do a search at Amazon; you'll be surprised. For our game, however, we need look no further than Director's built-in collision handling, although other methods will be discussed.



Macromedia Director MX 2004. Training from the Source
Macromedia Director MX 2004: Training from the Source
ISBN: 0321223659
EAN: 2147483647
Year: 2003
Pages: 166
Authors: Dave Mennenoh

Similar book on Amazon

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