0
votes

Using cocos2d v2 i was able to set some other class as a layer , and add it to some scene. I did it with :

BackgroundLayer *background=[[BackgroundLayer alloc] init];
[self addChild:[background set]]; //returns a Node

Where the background layer was a CCLayer . Now i am trying to do the exact same where the background layer is a CCNode , but it wouldn’t add it to the other scene , just perform its Init method .

How would i add some other CCNode class to another CCScene class as a layer ?

Thanks ,

1

1 Answers

4
votes

CCLayer no longer exists in Cocos2d V3, to be honest I see no reason for CCLayer anyways.

I think you are looking for CCNodeColor in this case.

For example:

CCScene *scene = [[CCScene alloc] init];
CCNodeColor *nodeColor = [CCNodeColor nodeWithColor:[CCColor redColor]];
[scene addChild:nodeColor];