I have this main scene in a game and I have called the menu where the user can choose the parameters for the new match (number of players, level of difficulty, etc).
This menu was created on a CClayer and presented on top of the main scene using this:
CCLayer *menu = [Menu node];
id actionFadeIn = [CCFadeIn actionWithDuration:0.3];
[menu runAction:[CCSequence actions:actionFadeIn, nil]];
[self addChild:menu z:1 tag:theMenu];
This menu's class has a basic logic there. For every parameter chosen on that menu a proper parameter is set on a singleton. Now that the user has chosen all parameters it will press the START GAME button.
When this happens, the menu has to vanish and a method called startGame has to run on the main scene, but this is my problem: How do I run the method from the menu class? I thought I could do
CCScene *currentScene = [[CCDirector sharedDirector] runningScene];
[currentScene startGame];
but I cannot do that because the current scene is not an instance itself and each of its methods can only be run from inside scene, but not from the outside.
I thought of using notifications to post an order to run the method on the class, but that sounded lame and like using a cannon to kill a fly. How the best way to do that in Cocos?
thanks.