cc.Class({ extends: cc.Component, properties: { catNode: cc.Node, catSkeleton: sp.Skeleton, }, onLoad() { this.catNode.on(cc.Node.EventType.TOUCH_START, () => { this.catSkeleton.setAnimation(0, 'hit', false); this.catSkeleton.setCompleteListener(() => { this.catSkeleton.setAnimation(0, 'stand', true); }); }, this); }, fly(startPosition) { this.catNode.setPosition(startPosition); this.catNode.setScale(0.1); let moveTo = cc.moveTo(0.4, 0, 0); let scaleTo = cc.scaleTo(0.4, 1, 1); this.catNode.runAction(cc.spawn(moveTo, scaleTo)); this.catSkeleton.setAnimation(0, 'hit2', false); this.catSkeleton.setCompleteListener(() => { this.catSkeleton.setAnimation(0, 'fly', true); let move = cc.moveTo(0.5, 293, 0); let scale = cc.scaleTo(0.5, 0.1, 0.1); let a = cc.spawn(move, scale); let finish = cc.callFunc(() => { this.node.destroy(); }, this); let s = cc.sequence(a, finish) this.catNode.runAction(s); }); }, start() { }, });