I was trying to create a gameover screen. It would create a new layer and place it on top of the current game layer and have a menu which would allow you to go home. But the menu doesn’t respond after I pause all actions, any way around this? Thanks!
//Pause all actions
[[CCDirector sharedDirector] pause];
//Create new black layer
CCLayerColor *gameover = [CCLayerColor layerWithColor:ccc4(0, 0, 0, 75)];
[self addChild:gameover z:1];
//add menu
CCMenuItemFont *item1 = [CCMenuItemFont itemFromString:@"Continue" target:self selector:@selector(goToMainMenu)];
CCMenu *menu = [CCMenu menuWithItems:item1, nil];
[gameover addChild:menu z:110];
EDIT: I am trying to create a transparent layer on top
Pausing the shared director pauses everything… I just asked this yesterday:
Is there anyway to have a the menu work even when I pause the game?
You can do what the guy did and also another method I found which was just inactivating all your scheduled selectors (i.e.
[self unschedule:@selector(gameLogicLoop:)];)And then you can reschedule the stuff after you are done clicking the menu (
[self schedule:@selector(gameLogicLoop:)];).