Chapter 15
Collision Detection
Collision detection is a key component to almost any game and almost every game type. In a game without collision detection, items, obstacles, characters, and weapons would move about the screen and float past each other without any consequence.
Your game code needs to be able to determine if objects that are on the screen touch or cross paths with each other. It is only after you determine that two or more objects are touching that you can then perform actions on them such as applying damage, stopping motion, powering up a character, or destroying an object.
This chapter will cover some solutions that aid you with problems in collision detection. Collision detection can be tricky, but the solutions in this ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access