Collideables

There are many times that we may want to check and see whether objects in the game have collided with each other. We may want to see whether the player has struck an obstacle or an enemy. We may have objects that the player can pick up, often called pickups or powerups.

Collectively, objects in the game that can collide with other objects are known as collideables. When we created our Sprite class, we actually it designed for this. Looking at the class constructor, you will notice that member variable m_isCollideable is set to false. When we write our collision detection code, we will ignore objects that have m_isCollideable set to false. If we want to allow an object to collide with other objects, we have to make sure to set m_collideable ...

Get OpenGL Game Development By Example 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.