// 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(event:cc.Event.EventKeyboard) { //設定目的地,坐標 var p3 = cc.v3(-300,-72,0); //var p2 = cc.v2(-300,-72); //取得大雄節點位置 var node_sprt = cc.find("Canvas/大雄"); console.log(p3); //取得大雄節點坐標 var p4 = node_sprt.getPosition(); //移動位置 node_sprt.setPosition(p3); console.log(node_sprt.getPosition()); //縮小 node_sprt.setScale(cc.v3(0.5, 0.5, 0)); } start () { } // update (dt) {} }