// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html const {ccclass, property} = cc._decorator; @ccclass export default class NewClass extends cc.Component { // @property(cc.Label) // label: cc.Label = null; // @property // text: string = 'hello'; onLoad () { this.node.on(cc.Node.EventType.MOUSE_DOWN, this.move, this); } move() { //抓取物件 var node1 = cc.find("Canvas/大雄"); //上下左右緩動 .by() cc.tween(node1) .by(1, {position: cc.v3(600,0,0)}) .by(1, {position: cc.v3(0,300,0)}) .by(1, {position: cc.v3(-600,0,0)}) .by(1, {position: cc.v3(0,-300,0)}) .start(); } start () { } // update (dt) {} }