Adding the gameplay layer

In order to keep all the enemies and bullets in the same layer, we will create a new layer named GameplayLayer. This is where the gameplay will add and remove enemies and bullets, update their positions, and check for collisions. So, create a class named GameplayLayer similar to how you created the enemy class earlier.

Now, make sure that the GameplayLayer.h and GameplayLayer.cpp files are in the Classes folder. Once you have checked this, open the GameplayLayer.h file and add the following lines of code to it:

#ifndef __wp8Game__GameplayLayer__ #define __wp8Game__GameplayLayer__ #include "cocos2d.h" using namespace cocos2d; class GameplayLayer: public CCLayer { public: GameplayLayer(); ~GameplayLayer(); void update(); ...

Get Learning Cocos2d-x Game Development 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.