如何在spritekit中重置倒数计时器

时间:2014-12-24 23:07:22

标签: ios objective-c sprite-kit nstimeinterval

如果分数可以被10整除,如何重置倒数计时器?

这是得分方法

-(void)setScore:(int)score
{
    _score = score;
    scoreLabel.text = [NSString stringWithFormat:@"Score: %d", score];
}

倒计时的更新方法

-(void)update:(CFTimeInterval)currentTime {
    /* Called before each frame is rendered */

    if (startGamePlay) {
        startTime = currentTime;
        startGamePlay = NO;
    }

    int countDownInt = 10.0 - (int)(currentTime - startTime);
    timeLabel.text = [NSString stringWithFormat:@"%i", countDownInt];

    if (self.score % 10 == 0) {

        //reset countDownInt here

    }

}

0 个答案:

没有答案