小编Zak*_*aki的帖子

惊人的分数值

请有人帮帮我.我试图使用下面的代码在屏幕上显示我的游戏的高分和分数,但我得到这些值

高:327178665342

得分:89254400

这与我在hud显示屏上的实际分数不一致.

这是我用来检索和显示分数的代码:

-(id)init{
self = [super init];
if (self != nil) {

      int score;
    _score = score;
    self.scoreLabel.string = [NSString stringWithFormat:@"Score: %d",_score];

        // 6
    NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
    NSInteger highScore = [defaults integerForKey:@"BatHighScore"];

        // 7
    if(score >= highScore) {
        highScore = score;
        [defaults setInteger:score forKey:@"BatHighScore"];
        [defaults synchronize];
    }

    self.highScoreLabel.string = [NSString stringWithFormat:@"High:    %d",highScore]

   }
 return self;
}

@end
Run Code Online (Sandbox Code Playgroud)

我在这里做错了吗?

iphone xcode objective-c cocos2d-iphone

1
推荐指数
1
解决办法
107
查看次数

在cocos2d中启动和停止粒子系统

请问,我想问一下如何在iOS/cocos2d中启动一个粒子系统,让它运行一段时间,比如10秒,然后让它停止.

我们将非常感谢一些代码片段或示例作为指南.

谢谢

iphone objective-c cocos2d-iphone ios

1
推荐指数
1
解决办法
3074
查看次数

标签 统计

cocos2d-iphone ×2

iphone ×2

objective-c ×2

ios ×1

xcode ×1