I am making one game where I have to implement main menu and then other parts of game. On launch my game will show main-menu on clicking of play-button game will start and so on for different buttons. So here I have to make transitions..let us say between two screen first is main menu and other is game screen. I took two classes mainMenu.cpp and GameScreen.cpp and inherited them from CCLayer and in static scene() method,I am returning the scene of respective class.
Here is the code:
here I am returning Scene from my pauseMenu class:
// 'scene' is an autorelease object
CCScene *scene = CCScene::create();
// 'layer' is an autorelease object
pauseScene *layer = pauseScene::create();
// add layer as a child to scene
// return the scene
and here I am creating that scene and replacing current scene on the touch event in ccTouchBegan method
// create a scene. it's an autorelease object
CCScene *pScene = pauseScene::scene();
Am I doing it correctly? Please help for the same I am not getting from where should I call or write this scene transition code. When I did above It is giving me error like :
"unknown type name NSString did you mean CString?" in NSObjcRuntime.h
I have tried few solutions(like adding header files,class forward declarations) from internet it din’t help. I am confused . Any help would be appreciable.