【发布时间】:2012-11-30 05:33:29
【问题描述】:
在 coco2d 游戏中,每 1/60 秒调用一次更新函数。
this.scheduleUpdate();
update: function (dt) { }
分数标签是
var scoreLabel = cc.LabelTTF.create("0", "fantasy", 20, cc.size(0, 0), cc.TEXT_ALIGNMENT_LEFT);
scoreLabel.setPosition(cc.p(winSize.width - 80, winSize.height));
scoreLabel.schedule(function () {
var showingScore = parseInt(scoreLabel.getString());
if (showingScore < b2.getUserScore()) {
scoreLabel.setString((showingScore + 5)
.toString());
}
});
this.addChild(scoreLabel, 5);
scoreLabel 多久更新一次?如何为 scoreLabel 设置一个计时器以每 2 秒更新一次?
【问题讨论】:
标签: cocos2d-iphone