I have the following code in my application.
I am new to developing games on iPhone using COCOS.
Sprite *bg=[Sprite spriteWithFile:@"menu.png"]; [bg setPosition:ccp(240,160)]; [self addChild:bg z:0]; [self addChild:[GameLayer node] z:1]; } return self;
}
@end @implementation GameLayer -(id)init{ if(self=[super init]){ Label *test=[Label labelWithString:@"Hello World" fontName:@"Helvetica" fontSize:24]; test.position=cpv(160, 240); test.visible=YES; [self addChild:test]; } return self; }
What is the function of ccp and cpv? (I think this is for setting the position of the layer, but I'm not sure. Therefore, I ask)
Sagar
source share