Hi,
I'm having a bit of a problem using the right strategy for showing and hiding different layers in my game.
What I'm trying to do is the following:
I have a HUD on the bottom of the screen with different Menu buttons.
If i touch one of the buttons a different "scene" / layer has to be made visible, all the other scenes just have to hide.
I first tried to switch scenes, but I need all the invisible scenes to keep running, or at least retain all variables, sprite positions, etc.
So right now I have my HUDLayer class, which has the menu items and selector function in it.
I then add a Scene's node to the current scene using addChild.
But I can't hide it, when I touch another button.
Example code:
-(void) showLayer1: (CCMenuItem*)menuItem{
// Hide layer2
[[self getChildByTag:100] setVisible:NO];
}
- (void) showLayer2: (CCMenuItem *) menuItem{
self.layer2 = (CCLayer*)[Layer2Scene node];
[self addChild:self.layer2 z:10 tag:100];
}
I hope I was able to make sure what my problem is.
Best regards and thanks in advance,
Marcel