private _acceleration = 0.1;//加速度
public startRunning() { console.log("startr") this._isMove = true; this._speed = 0.2; this._acceleration = 0.2; } public stopRunning() { console.log("stop") this._acceleration = -0.2; //this._isMove = false; }
this._speed = this._speed + this._acceleration * dt; if(this._speed>this.maxSpeed){ this._speed = this.maxSpeed; } if(this._speed < 0.01){ this._isMove = false; }
站长微信:xiaomao0055
站长QQ:14496453