刚接触Creator,遇上一个蛮棘手的问题,恳请各位大大赐教。
在真机上运行时发现节点的运动会间歇性卡顿,试过多款手机均有不同程度的卡顿。
就算只有一个节点反复运动(并不高速),也会有卡顿现象。
通过定时或碰撞添加多个运动节点时卡顿明显,通过点击等方法主动添加情况较好,但在部分手机上依旧卡顿明显。
最简单的情况(单个单色sprite节点):
update: function (dt) {
if(this.node.getPositionX()>550){
this.node.setPositionX(-550);
};
this.node.setPositionX(this.node.getPositionX()+10);
},
或(添加节点):
addBar: function () {
var bar = this._pool.get();
if (!bar) {
bar = cc.instantiate(this.BarPrefab);
};
bar.setPosition(-550,0);
bar.runAction(cc.sequence(
cc.moveTo(2, 550, 0),
cc.callFunc(this.putNode, this, bar)
));
this.node.addChild(bar);
},
putNode: function (sender, bar) {
this._pool.put(bar);
},
做了个简单的DEMO,包涵了多种会产生卡顿的情况。NodeTest.zip (2.8 MB)
