- (void) updateScore:(NSTimeInterval) currentTime
{
for(int i=0;i<nbObstacles;i++){
SKSpriteNode * topPipe = (SKSpriteNode *) topPipes[i];
// Score, adapt font size
if(X(topPipe) + WIDTH(topPipe)/2 > bird.position.x &&
X(topPipe) + WIDTH(topPipe)/2 < bird.position.x + FLOOR_SCROLLING_SPEED){
self.score +=1;
scoreLabel.text = [NSString stringWithFormat:@"%lu",self.score];
if(self.score>=10){
scoreLabel.fontSize = 340;
scoreLabel.position = CGPointMake(CGRectGetMidX(self.frame), 120);
}
}
}
}
答案 0 :(得分:0)
// Score, adapt font size
if(X(topPipe)+1 > bird.position.x &&
X(topPipe) < bird.position.x + FLOOR_SCROLLING_SPEED){
self.score +=1;
这解决了一切