Game Development Reference
In-Depth Information
-(GameLayer*) gameLayer
CCNode* layer = [self getChildByTag:LayerTagGameLayer];
NSAssert([layer isKindOfClass:[GameLayer class]], @"%@: not a GameLayer!", ←
return (GameLayer*)layer;
-(UserInterfaceLayer*) uiLayer
CCNode* layer = [[MultiLayerScene sharedLayer] getChildByTag:LayerTagUILayer];
NSAssert([layer isKindOfClass:[UserInterfaceLayer class]], @"%@: not a UILayer!", ←
return (UserInterfaceLayer*)layer;
This makes it easy to access the various layers from any node of the MultiLayerS-
cene .
▪ You can access the “scene” layer of MultiLayerScene :
MultiLayerScene* sceneLayer = [MultiLayerScene
▪ You can access the other layers through the scene layer:
GameLayer* gameLayer = [sceneLayer gameLayer];
UserInterfaceLayer* uiLayer = [sceneLayer uiLay-
▪ As an alternative, because of the @property definition, you can also use
the dot accessor. Whichever you prefer is up to you, as long as you stick
to it consistently. Technically and performance-wise, there's absolutely no
GameLayer* gameLayer = sceneLayer.gameLayer;
UserInterfaceLayer* uiLayer = sceneLayer.uiLayer;
Search Nedrilad ::

Custom Search