在 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 秒更新一次?