I got this scene my overviewScene, in this scene i add self as layer, and a MainMenu layer.
The overview layer show some stats about the player, and the menu layer is displayed at the top. Now when the player clicks on a menu point in the menu, i want to change the overview layer out with another layer.
But the problem is, i can’t seem to remove the overviewscene layer from the MainMenu class, is this even possible?
:: Update ::
i believe this i what i have tried, let me print some code. This is from my MainMenuLayer
CCMenuItemFont menu_overview = [CCMenuItemFont itemFromString:@"Overview" target:self.parent selector:@selector(test)];
The parent would be my overviewScene as this layer was added my that class right?
From overviewScene
-(void)test {
// CCScene *scene =[[CCDirector sharedDirector] runningScene];
// CCLayer *parentz = (CCLayer) self.parent;
//[[scene removeChild: cleanup:YES];
[[OverviewScene node] removeFromParentAndCleanup:YES];
}
The correct way to do this would be to have a parent scene that has the “overview”, the new layer you want to show and the “MainMenu” layers added as a child layers. This way you can simply do:
As long as you keep the z index of each layer set correctly to maintain hierarchy this will solve your problem.