hello,
i started out learning cocos2d and came across these lines of code:
-(id)init {
self=[super init];
if(self!=nil) {
Sprite *bg = [Sprite spriteWithFile:@"menu.png"];
[bg setPosition:ccp(240,160)];
[self addChild:bg z:0];
[self addChild:[MenuLayer node] z:1];
}
return self;
}
I ran the same lines of code with the following modification:
-(id)init {
self=[super init];
if(self!=nil) {
Sprite *bg = [Sprite spriteWithFile:@"menu.png"];
[bg setPosition:ccp(240,160)];
[self addChild:bg];
[self addChild:[MenuLayer node]];
}
return self;
}
Removing the 'z' parameter brought no change in the output, so what is its significance and what is it used for?
Thanks