Game Development Reference
In-Depth Information
Detecting bitmap collisions
As a final word, you should be aware of one other collision-detection system that's not discussed in
the topic: bitmap collision detection . Bitmap collision detection allows you to detect a collision
between two objects based on their exact shapes.
Using it requires a relatively advanced understanding of AS3.0, which is a bit beyond the scope of this
introductory topic. It's also very processor-intensive, so it can really slow your games down if it's not
used judiciously. And even though precise shape versus shape collision detection sounds great in the-
ory, in practice you'll find that are actually few collision-detection scenarios that can't be adequately
handled with careful application of the techniques covered in this chapter and refined in the rest of
the topic.
Still, there are some cases in which bitmap collision detection is essential. Imagine a game like Worms ,
in which you can use a variety of weapons to destroy irregularly shaped patches of an opponent's
environment. Bounding boxes won't help you there; you need some way of changing individual pixels.
Or imagine a game in which you need to navigate a spaceship through an underground lunar cave full
of irregularly shaped jagged rocks. Bitmap collision detection is perfect for those kinds of situations.
When you're ready for another challenge, a web search will turn up quite a bit of information of how
to do bitmap collision detection with AS3.0. Keith Peters's excellent topic, AdvancED ActionScript 3.0
Animation (friends of ED, 2009), devotes part of a chapter to this subject.
Summary
Collision detection is quite a big subject in game design, and hopefully the introductory taste you've
had of it here is enough whet your appetite for what's to come.
But before you jump ahead to the next chapter you might want to take short break to make a game.
Hey, don't be scared; you can do it! And that's what this topic is all about, after all. If you combine the
collision-detection techniques from this chapter with the player-control techniques from the last one
(along with the logical analysis you looked at in the number guessing game), you have all the tools you
need to make some pretty sophisticated games.
In the next chapter, you'll combine all your new skills and learn a few fun new ones to create a game
called Dungeon Maze Adventure . And unlike any of the previous games in this topic, it will be pro-
grammed in a completely object-oriented way. What do I mean by that? Turn the page to find out!
 
Search Nedrilad ::




Custom Search