FAQ

Here are some questions that might be on your mind:

Q) Are there any better ways of doing collision detection?

A) Yes. There are lots more ways to do collision detection, including but not limited to the following:

  • You can divide objects into multiple rectangles which better fit the shape of the sprite. It is perfectly manageable for C++ to check on thousands of rectangles each frame. This is especially true when you use techniques such as neighbor checking to reduce the number of tests that are necessary each frame.
  • For circular objects, you can use the radius overlap method.
  • For irregular polygons, you can use the crossing number algorithm.

    All these techniques can be investigated at the following website:

  • Neighbor checking: http://gamecodeschool.com/essentials/collision-detection-neighbor-checking/ ...

Get Beginning C++ Game Programming 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.