赞 | 2 |
VIP | 0 |
好人卡 | 0 |
积分 | 8 |
经验 | 3153 |
最后登录 | 2023-10-8 |
在线时间 | 108 小时 |
Lv2.观梦者
- 梦石
- 0
- 星屑
- 801
- 在线时间
- 108 小时
- 注册时间
- 2016-7-9
- 帖子
- 42
|
2楼
楼主 |
发表于 2017-9-3 00:43:04
|
只看该作者
// 方向
Game_Player.prototype.moveByInput = function() {
if (this._ladder) {
if (Input.isPressed('up')) {
this.setDirection(8);
this._vy = Math.max(this._vy - this._ladderAccele, -this._ladderSpeed);
this._moveCount = 4;
this.resetStopCount();
} else if (Input.isPressed('down')) {
this.setDirection(8);
this._vy = Math.min(this._vy + this._ladderAccele, this._ladderSpeed);
this._moveCount = 4;
this.resetStopCount();
}
if (!this.isCollideLadder(false)) {
this.getOffLadder();
}
} else {
if (!this.isDashing()) {
if (Input.isPressed('left')) {
var speed = this.isGuarding() ? -this._moveSpeed * actGuardMoveRate / 100 : -this._moveSpeed;
this.setDirection(4);
if (this._vx > speed) {
var accele = Math.max(this._accele - this._friction, 0);
this._vx = Math.max(this._vx - accele, speed);
}
this._moveCount = 4;
} else if (Input.isPressed('right')) {
var speed = this.isGuarding() ? this._moveSpeed * actGuardMoveRate / 100 : this._moveSpeed;
this.setDirection(6);
if (this._vx < speed) {
var accele = Math.max(this._accele - this._friction, 0);
this._vx = Math.min(this._vx + accele, speed);
}
this._moveCount = 4;
}
}
if (Input.isPressed('up')) {
if (this.isCollideLadder(false)) this.getOnLadder(false);
} else if (Input.isPressed('down')) {
if (this.isCollideLadder(true)) this.getOnLadder(true);
}
}
};
这段 代码要加入 个控制 插件开关 应该在么写 |
|