Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我还是 cocos2d 的新手,想知道你们中的任何人是否可以帮我做一个计分器。我看到了一些这样的问题,但看起来它是针对旧版本的 cocos2d 的。我希望计时器从零开始并在几分钟和几秒钟内上升。非常感谢我得到的任何帮助或建议。
启动每秒运行的 NSTimer 并调用更新计时器的方法。
在标题中定义一个称为秒的整数和另一个称为分钟的整数。
-(void)updateTheTime { seconds++; if (seconds == 60) { seconds = 0; minutes++; } label.text = [NSString stringWithFormat:@"%i:%i", minutes, seconds]; }