Configuración de Cocos2d CCScene y CCLayer

Sorry for the newbie question but I was wondering what the difference is between these two different setups for the scene & the layer? I have tried both ways and each one works but I just don't know what the difference is or which one I should use.

@implementation Game

+(id) scene {
CCScene *scene = [CCScene node];
[scene addChild:[Game node]];
return scene; }

O de esta manera.

@implementation Game

+(id) scene {

CCScene *scene = [CCScene node];
Game *layer = [Game node];
[scene addChild:layer];
return scene; }

preguntado el 30 de junio de 12 a las 17:06

1 Respuestas

I don't see any difference between your 2 sample of code. Your 2 methods are identically the same.

[Game node] returns a layer so in the first case you add it directly into your scene and in the 2 example you just put it into a variable then add it into your scene. For the compiler this is the same thing here.

Respondido el 30 de junio de 12 a las 20:06

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.