使用IF语句的Objective-C停止计数器

使用IF语句的Objective-C停止计数器,objective-c,cocoa-touch,cocos2d-iphone,Objective C,Cocoa Touch,Cocos2d Iphone,我有一个使用if语句的计分器 if (CGRectIntersectsRect(aliens.boundingBox, heroe.boundingBox)) { heroe.visible = NO; //HOW DO I STOP THE SCORE++ HERE? } else { score++; [scoreLabel setString: [NSString stringWithFormat:@"%i", s

我有一个使用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]];

  }
我找不到阻止比分的办法++

有什么提示吗?

试试这个

if (CGRectIntersectsRect(aliens.boundingBox, heroe.boundingBox)) {

heroe.visible = NO;

}
else{
if(heroe.visible == yes)
score++;

[scoreLabel setString: [NSString stringWithFormat:@"%i", score]];

}

太好了!谢谢你的快速帮助!效果很好。