Question

I want to create a Game Over Pop Up, with two buttons and a high score label etc.. This pop up will be visible when the game over event happens and the gameplay scene will be paused.

I tried to implement a game over scene (a separate GameOver class) successfully, but that's not what I want, as it replaces my current gameplay scene and appears on full screen. I want the game over small pop up to appear ON the gameplay scene, while the gameplay scene will be paused (thus indicating game over), and only the game over pop up's buttons will be active.

I think I can achieve this by creating a game over layer (CCNode in v3 rather), but I haven't used multiple layers in a Scene yet (as currently I haven't explicitly defined any CCNode, just adding children to self and everything is working great), also I'm not sure of how can I pause the gameplay only, and let the game over layer (Popup) be active.

Please please guide me with this as this is the only thing left in my game.

Thanks a lot!

Was it helpful?

Solution

Read this article and figured out how to add multiple layers on a single Scene.

Instead of calling replaceScene we can just add another layer by

[[CCDirector sharedDirector] pause]; //Pauses current scene [self addChild:[GameOverNode node]]; //adds the GameOver Layer

The added layer's buttons remain active while the GamePlay layer is paused. GameOverNode is still another class.

Hope this is helpful for any one who has a similar problem like mine.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top