Book Image

Learning Cocos2d-x Game Development

By : Siddharth Shekar
Book Image

Learning Cocos2d-x Game Development

By: Siddharth Shekar

Overview of this book

Table of Contents (19 chapters)
Learning Cocos2d-x Game Development
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
Index

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 on the character. An odd-shaped character would call for an advanced collision detection method, demanding high precision, which would take more time in testing and debugging, eventually either delaying the project or leading to reworking on the character...