// 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("mousedown", this.show, this); } show() { //(1)get 節點/組件 //javasceipt寫法 var node = cc.find("Canvas/大雄/名字"); //typesceipt寫法,都可以 //let node:cc.Node = cc.find("Canvas/大雄/名字"); //(2)移動名字位置 node.setPosition(0, -300); } start () { } // update (dt) {} }