import { _decorator, Component, Node, input, Input, EventTouch } from ‘cc’;
import { Player } from ‘./Player’;
const { ccclass, property } = _decorator;
@ccclass(‘tiaoyue’)
export class tiaoyue extends Component {
onTouchStart(event: EventTouch) {
console.log(event.getLocation()); // Location on screen space
console.log(event.getUILocation()); // Location on UI space
this.node.getComponent(Player).tiaoyue();
}
}
建立的一个按钮,点击时调用player的tiaoyue()方法,然后就会报错