15. Collision Detection

This chapter reviews how collision detection has been implemented within Sir Lamorak’s Quest, as well as the common problems that need to be solved. Without collision detection, the player and game characters would be able to wander through walls, and we’d have no way of knowing when the player or entities hit each other.

Although this chapter is titled “Collision Detection,” it is important to remember that collision response should also be included. Detecting a collision and then responding are two different stages that need to be managed separately. This doesn’t mean that they cannot physically be managed together in code, but that they should be considered separately when designing and implementing collision detection ...

Get Learning iOS Game Programming now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.