import { GameLogic } from "./GameLogic"; const {ccclass, property} = cc._decorator; @ccclass export default class Move extends GameLogic { private _speed: number = 100; public get speed(): number { return this._speed; } public set speed(value: number) { this._speed = value; } private _dirction: cc.Vec2 = cc.v2(0, 0); public get dirction(): cc.Vec2 { return this._dirction; } public set dirction(value: cc.Vec2) { this._dirction = value; } gameUpdate(dt: number): void { this.node.x += this.speed * dt * this.dirction.x; this.node.y += this.speed * dt * this.dirction.y; } }