Using CCLayerMultiplex

The CCLayerMultiplex class provides functionality to seamlessly switch between multiple layers. In this example, we have three similar layers assigned to a multiplex layer. Each layer displays buttons used to switch to any of the other layers.

Using CCLayerMultiplex

Getting ready

Please refer to the project RecipeCollection02 for full working code of this recipe.

How to do it...

Execute the following code:

@interface MultiplexLayerMenu : CCLayer {} +(id) layerWithLayerNumber:(int)layerNumber; -(id) initWithLayerNumber:(int)layerNumber; -(void) goToLayer:(id)sender; @end @implementation MultiplexLayerMenu +(id) layerWithLayerNumber:(int)layerNumber { ...

Get Cocos2d for iPhone 1 Game Development Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.