0
내 메인 레이어의 스코어를 내 스코어에 따라 초기화하는 CCSprite 중 하나로 전달하려고합니다. 내 CCSprite 초기화 할 때 :Cocos2d의 오브젝트로 CCSprite 초기화하기
//Main Layer
Platform *platform = [[Platform alloc] initWithSpriteFrame:[[CCSpriteFrameCache sharedSpriteFrameCache]spriteFrameByName:@"platform.png"] withScore:score];
//CCSprite Layer
-(id) initWithSpriteFrame:(CCSpriteFrame*)spriteFrame withScore:(int)initScore {
if((self=[super init])) {
...
}
}
나는 CCSprite 질감이없는 점수를 얻습니다. 그 후
, 나는이 함께 초기화 :
//Main Layer
Platform *platform = [[Platform alloc]initWithSpriteFrame:[[CCSpriteFrameCache sharedSpriteFrameCache]spriteFrameByName:@"platform.png"]];
[platform setScore:score];
//CCSprite Layer
@property (readwrite) int score;
@synthesize score;
-(id) init {
if((self=[super init])) {
...
}
}
나는 어떤 점수 (는 0이다)와 CCSprite 텍스처를 얻을. 할 사람이 뭐야?
감사합니다. 완벽하게 작동합니다. –