2012-08-29 24 views
-2

我有使用比分反超if語句的Objective-C停止計數器的使用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

試試這個

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

heroe.visible = NO; 

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

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

}

+0

太好了!感謝您的快速幫助!它工作得很好。 – ARFIRST