Collision Detection

KEY TOPICS

Remember Pong? Whether it's a pong ball bouncing off a paddle, a laser hitting a robot, an adventurer falling down a pit, the hero finding some ammo, two monsters ramming into one another, or just the player walking into a wall, you're going to need some sort of collision detection in almost any game. In , "Creating a 2D Platform Game," you made some basic 2D collision detection that worked well for a 2D tile-based game. In this chapter, you'll expand on the ideas presented there, provide more thorough object-to-object collision detection, and provide collision detection against polygons stored in BSP trees. Also, and just as important, we'll show different ways of handling a collision after it's detected, such as sliding along walls or letting game objects handle their own collision behavior.