我有一个使用if语句的分数计数器
if (CGRectIntersectsRect(aliens.boundingBox, heroe.boundingBox)) {
heroe.visible = NO;
//HOW DO I STOP THE SCORE++ HERE?
}
else {
score++;
[scoreLabel setString: [NSString stringWithFormat:@"%i", score]];
}
我无法找到一种方法来阻止分数++
任何提示?
答案 0 :(得分:0)
尝试这个
if (CGRectIntersectsRect(aliens.boundingBox, heroe.boundingBox)) {
heroe.visible = NO;
}
else{
if(heroe.visible == yes)
score++;
[scoreLabel setString: [NSString stringWithFormat:@"%i", score]];
}