Game Development Reference
In-Depth Information
Organizing the game
Once again, there is a b2Sprite class, and the Eskimo and Platform classes extend
b2Sprite . Then there are the regular Sprite classes, GSwitch (which stands for
gravity switch) and Igloo . The logic runs collision detection between these last two and
Eskimo , but I chose not to have them as sensor bodies because I wanted to show you that
2D collision logic for the Cocos2d-x elements can coexist with collision logic for the
Box2D elements just fine.
But most importantly, this game now has three scenes. So far in this topic, we've only used
one scene per game. This game's scene objects will wrap MenuLayer ,
LevelSelectLayer , and GameLayer . Here's a brief note on all three:
• In MenuLayer , you have the option to play the game, which will take you to
LevelSelectLayer or to play a tutorial for the game, which will take you to
GameLayer .
• In LevelSelectLayer , you may choose which available level you want to
play, and that will take you to GameLayer . Or you may go back to MenuLayer .
• In GameLayer , you play the game, and may go back to MenuLayer upon game
over.
The following image illustrates all three scenes in the game:
Search WWH ::




Custom Search