Book Image

Cocos2d-X Game Development Blueprints

By : Karan Sequeira
Book Image

Cocos2d-X Game Development Blueprints

By: Karan Sequeira

Overview of this book

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

Tile-based collision detection


Tile-based games having been there for so long, there are a whole bunch of different techniques developers have used to implement collision detection in their games. While learning the subject myself, I came across this brilliant article written by a programmer named Rodrigo Monteiro (http://higherorderfun.com/blog/). He has described a few of the techniques used for tile-based collision detection and cataloged a lot of information on them in the article, which you can find here: http://higherorderfun.com/blog/2012/05/20/the-guide-to-implementing-2d-platformers/.

The algorithm we will be using is based on the pseudo code that Rodrigo describes in the article. The reason we are discussing collision detection before any of the other gameplay is because this algorithm is flexible in nature and can be plugged in to any other tile-based game with little or no modifications necessary. It can be used even in games that are not made with Tiled. I can vouch for this...