Creating the Options scene
Similar to how we created the MainMenuScene
, we will create OptionsMenuScene.h
and OptionsMenuScene.cpp
and include them in the Solution Explorer pane.
In the OptionsMenuScene.h
file, add the following code:
#ifndef __wp8Game__OPTIONSMENU_SCENE__ #define __wp8Game__OPTIONSMENU_SCENE__ #include "cocos2d.h" #include "ScrollingBgLayer.h" using namespace cocos2d; class OptionsMenu : public cocos2d::CCLayer { public: virtual bool init(); ScrollingBgLayer* scrollingBgLayer; static cocos2d::CCScene* scene(); void update(float dt); void reset(CCObject* pSender); void mainMenu(CCObject* pSender); CREATE_FUNC(OptionsMenu); }; #endif
Here once again, we include ScrollingBgLayer.h
, inherit from CCLayer, and add in the usual code, as we did in the MainMenuScene.h
class. Here, we add two functions named reset()
and mainMenu()
, which will reset the score and take us back to the main menu once the respective buttons are clicked.
Next, we...