Book Image

Cocos2d-x by Example: Beginner's Guide

By : Roger Engelbert
Book Image

Cocos2d-x by Example: Beginner's Guide

By: Roger Engelbert

Overview of this book

Table of Contents (19 chapters)
Cocos2d-x by Example Beginner's Guide Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

The game – Stone Age


This is a match-three game. You know, the kind of game that is making a couple of companies a gazillion dollars and making a gazillion other companies clone those games in order to earn a couple of dollars. Yes, that game!

You must match three or more gems. If you match more than three, a random gem bursts and turns into a diamond, which you collect for more points.

The game has a timer, and when time runs out, it's game over.

I used pretty much the same structure as in the previous games in this book. But I broke it into separate modules so it's easier for you to use the code as a reference.

We have a MenuScene and a GameScene item. I have pretty much all Cocos2d-x actions in one module called GridAnimations and most of the interactivity inside another module called GridController. And all object pools are kept inside a class called ObjectPools.

This is a grid game, so it's perfect to illustrate working with table arrays in Lua, and its main advantages over C++: it's much...