Summary
In this chapter, we saw various ways in which collisions could be detected in games, and we implemented box collision detection for the game. We added scoring, the game over condition, and display text on the screen.
Collision detection is a vital part of any game, and its implementation could make or break the game. There is a tradeoff between precision and performance when you use a simple method, such as box collision detection versus pixel perfect collision. This is where the job of the game designer becomes critical. They have to pay close attention to the size and shape of the characters. The characters have to be simple so that they look interesting, and at the same time, we need to make sure that it is easier to compute collision ...
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