// 顺序执行两个动作
node.runAction(
cc.sequence(cc.moveTo(),
cc.rotateTo(),
cc.callFunc(() => {})
);
)
// 并行执行两个动作
node.runAction(
cc.spawn(cc.moveTo(),
cc.rotateTo(),
cc.callFunc(() => {})
);
)
buttonShake(node) {const actionLeft = cc.moveBy(0.1, cc.v2(-5, 0));
const actionRight = cc.moveBy(0.1, cc.v2(10, 0));
const actionLeftSecond = cc.moveBy(0.1, cc.v2(-10, 0));
const actionRightSecond = cc.moveBy(0.1, cc.v2(5, 0));
return new Promise(resolve => {
node.runAction(
cc.sequence(actionLeft, actionRight, actionLeftSecond, actionRightSecond,
// 执行动作完成之后调用的方法
cc.callFunc(() => {cc.log(3333);
resolve();}))
);
});
},
this.leftTutu.runAction(
cc.sequence(cc.fadeIn(0.6),
cc.callFunc(() => {this.buttonShake(event.target).then(() => {cc.log(44444);
this.scheduleOnce(() => {cc.log(2222222);
this.buttonShake(event.target);
}, 0.8);
});
this.playAudio(this.rightAudio).then(() => {this.xxxx();
});
})
)
);