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 ...

Get Learning Cocos2d-x Game Development 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.