使用的是1.4.2
代码
//不停产生尾巴
runAddTailAction: function()
{
var dt = 4/this.speed;
var action = cc.repeatForever(cc.sequence(
cc.callFunc(function(){
this.createSection();
},this),cc.delayTime(dt)
));
action.setTag(125);
this.node.stopActionByTag(125);
this.node.runAction(action);
},
//创建蛇的段
createSection: function()
{
var node;
console.log("--->>>",this.sectionPool.size());
if(this.sectionPool.size() > 0)
{
node = this.sectionPool.get();//返回pool中的对象
}
else
{
node = cc.instantiate(this.sectionPrefab);
}
node.color = this.node.color
node.scale = this.node.scale
node.rotation = this.node.rotation
node.x = this.node.x
node.y = this.node.y
node.parent = this.node.parent
var dt = 1.5;
var action = cc.sequence(
cc.delayTime(dt),
cc.scaleTo(dt / 2, this.node.scale - 1),
cc.callFunc(function(){
this.sectionPool.put(node)
}, this),
)
node.runAction(action)
},
打印
Simulator: :0:({x:358, y:16760, width:100, height:100}) is not a function
Simulator: :0:({x:602, y:16396, width:100, height:100}) is not a function
