Chapter 4. Collision Detection and Scoring

Continuing from where we left off in the previous chapter, we will look at collision detection and keeping track of the score in the game in this chapter. Apart from just coding collision detection, we will also look at the different types of collision mechanics in games, be it circular, box, per-pixel, or Box2D collision. Bear in mind that what we will be going through are just few ways of collision detection. A whole book can be dedicated to the topic. What is important for any developer is that they make sure the collision is detected without taxing the CPU too much.

In this chapter, we will cover the following topics:

  • Theory of collision detection
  • Circular collision detection
  • Box collision detection

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.