How to create transparent ccscene in cocos2d?

I need to show ccscene on pause the game. But it must be transparent. Can anyone help me with this?

Thanks,

Anks

+4
source share
2 answers

I suggest you not create a separate scene for the pause layer. What you can do is create a layer similar to the HUD Layer .
The second option would be for something like this . Do not set the background color of the layer.
Hope this helps.

+4
source

I know that you already have an answer, but I wanted to share my solution, because I got into this link when investigating the same problem. I also posted this on cocos2d forums.

- (void)pauseSchedulerAndActionsRecursive:(CCNode *)node { [node pauseSchedulerAndActions]; for (CCNode *child in [node children]) { [self pauseSchedulerAndActionsRecursive:child]; } } - (void)resumeSchedulerAndActionsRecursive:(CCNode *)node { [node resumeSchedulerAndActions]; for (CCNode *child in [node children]) { [self resumeSchedulerAndActionsRecursive:child]; } } 

I have one scene and two layers, a scene / gameplay level and a menu layer. My menus revive and go out, and I wanted my pause menu to be able to revitalize and turn off. So I just added the above functions to my scene / gameplay level. Then, when the user pauses, I call pauseSchedulerAndActionsRecursive: at my scene / gameplay level and add my menu layer to the scene above. My menu swallows all touches, so the touch also turns off at the scene / game level, until the menu layer is up. Then just call the resumeSchedulerAndActionsRecursive: method to resume. Hope this helps someone.

+2
source

All Articles