cc.Class({
extends: cc.Component,
properties: {
},
Shake()
{
this.pos = this.node.getPosition()
let act1 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y + 5))
let act2 = cc.moveTo(0.03,cc.v2(this.pos.x - 4,this.pos.y + 5))
let act3 = cc.moveTo(0.03,cc.v2(this.pos.x - 4,this.pos.y + 3))
let act4 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y - 6))
let act5 = cc.moveTo(0.03,cc.v2(this.pos.x - 5,this.pos.y + 5))
let act6 = cc.moveTo(0.03,cc.v2(this.pos.x + 2,this.pos.y - 8))
let act7 = cc.moveTo(0.03,cc.v2(this.pos.x - 8,this.pos.y - 10))
let act8 = cc.moveTo(0.03,cc.v2(this.pos.x + 3,this.pos.y + 10))
let act9 = cc.moveTo(0.03,this.pos)
let rep = cc.repeatForever(cc.sequence(
act1,act2,act3,act4,act5,act6,act7,act8,act9
))
this.node.runAction(rep)
setTimeout(()=>{
if(this.node)
{
this.node.stopAllActions()
this.node.setPosition(this.pos)
}
},1000)
},
});
网友评论