cocos2d-android: how to display score(cocos2d-android:如何显示分数)
问题描述
我在更新方法中添加了 CCLabel 以显示我的游戏分数.
它在分数提高到 5000 之前运行良好.之后 logCat 显示消息:
I added CCLabel in my update method to display my game score.
It works well before score raise to 5000. After that logCat shows the messege:
我的代码是:
如何解决?
推荐答案
我认为您每次需要时都在创建 CCLabel.
I think you are creating CCLabel every time when you need.
不要那样做.
将您的 ScoreLable 设置为全局变量,并在构造函数中完成它的初始化、颜色设置和定位.在您的情况下,仅使用以下代码.
Don't do that.
Set your ScoreLable as global variable and complete its initialization, color setting and positioning in constructor. In your condition use only following code.
这篇关于cocos2d-android:如何显示分数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!