Chapter 9. Collision Detection

[ LiB ]

Chapter 9. Collision Detection

We are nearing the end of Part Two. This chapter explains the art of collision detec-tion. Collision detection allows your program to check if an object on your screen has been hit by another object, and performs actions based on the check. For example, if you made a space shooter, and you wanted to check if a missile hit an enemy ship, you would use collision detection. If the ship had been hit, you might decrease its hit points, or destroy it all together.

There are a few ways to check for collision detection, and we are going to go through them now. We can use bounding boxes, both rectangular and circular, and pixel-perfect collisions. Let's start off checking collision with a single pixel.

[ LiB ]


Game Programming for Teens
Game Programming for Teens
ISBN: 1598635182
EAN: 2147483647
Year: 2004
Pages: 94
Authors: Maneesh Sethi

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