123456789101112131415161718192021222324252627282930313233343536373839404142434445464748 |
- 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() {
- },
- });
|