import { _decorator, Component, EventTouch, Input, input, Node } from 'cc'; const { ccclass, property } = _decorator; @ccclass('PlayerContorl') export class PlayerContorl extends Component { _speed=200; _initPosX=0; start() { this.node.on(Node.EventType.TOUCH_MOVE,this.touchMove,this) this._initPosX=this.node.position.x; } touchMove(event:EventTouch) { const delta=event.getDelta() let pos=this.node.position; this.node.setPosition( this._initPosX,pos.y+0.01*this._speed*delta.y) } update(deltaTime: number) { } }