action_array: {//动作集合
default: [],
type: [cc.ActionInterval]
}
//这部分是不固定的
var goLeft = cc.moveTo(0.2, cc.p(this.player.getPositionX()), -this.node.width / 2 + this.wallWidth);
var goL1 = cc.moveTo(0.1, cc.p(this.player.getPositionX()), -this.node.width / 2 + this.wallWidth + 30);
var goL2 = cc.moveTo(0.1, cc.p(this.player.getPositionX()), -this.node.width / 2 + this.wallWidth);
this.fg_array.push(goLeft);
this.fg_array.push(goL1);
this.fg_array.push(goL2);
//var sque = cc.sequence(this.fg_array); ///这样报错的
///var sque = cc.sequence(goLeft,goL1,goL2);
//this.player.runAction(sque);
我是直接…
let actions = [];
actions.push( cc.move( 0.5, cc.p( x, y ) );
actions.push( cc.callFunc( function(){ cc.log('action 2'); } ) );
actions.push( cc.move( 0.4, cc.p( x, y ) );
actions.push( cc.callFunc( function(){ cc.log('action 4'); } ) );
actions.push( cc.move( 0.3, cc.p( x, y ) );
actions.push( cc.callFunc( function(){ cc.log('action finish'); } ) );
node.runAction( cc.sequence( actions ) );
這樣是可以跑的
你这个语法不是cocos Creator 吧?
嗯,是JS的语法