에서 점수 레이블을 어떻게 증가시켜 레이블을 만들 수 있으며 이미지가 다른 이미지와 충돌하면 10 점이 증가합니다. 점수 = 점수 +10; 하지만이 대신 40의 증가 이유를 모르겠습니다. 그래서 여기 내 코드는 다음과 같습니다에 대한cocos2d
-(id) init
{
if((self=[super init])) {
[self schedule:@selector(update:)];
score = 0;
scoreLabel = [CCLabelTTF labelWithString:[NSString stringWithFormat:@"%d",score] fontName:@"PUSAB___.TTF" fontSize:15 ];
scoreLabel.position=ccp(450,30);
[self addChild:scoreLabel];
}
}
- (void)update:(ccTime)dt {
if (CGRectIntersectsRect(mangeurRect, targetRect)) {
[targetsToDelete addObject:target];
score=score + 10; ;// Not really, but your score changes somehow...
[scoreLabel setString: [NSString stringWithFormat:@"%d",score]];
}
}
미안 내 영어 나 프랑스어 해요 :/
영어 실력은 괜찮습니다. 그러나 코드 서식 지정 ... :) – Almo
lol !! 그래서 문제는 무엇입니까 ?? :) –
"mangeurRect"및 "targetRect"는 어떻게 초기화합니까? 모든 프레임 또는 상수 로컬 스프라이트 바운딩 박스를 업데이트해야하는 화면 관련 rect입니까? –