//============================================================================= // komasanno8houkouidou //============================================================================= /*: * @target MZ * @plugindesc 8move * @author koma * * @param * @desc * @default 1 * * @help This plugin does not provide plugin commands. * */ /*:ja * @target MZ * @plugindesc 8方向移動 * @author koma * * @param * @desc * @default 1 * * @help このプラグインには、プラグインコマンドはありません。 * */ (function () { "use strict"; Game_Player.prototype.getInputDirection = function () { return Input.dir8; }; Game_Player.prototype.executeMove = function (direction) { if (direction % 2) { var horz = direction % 3 ? 4 : 6; var vert = direction < 5 ? 2 : 8; this.moveDiagonally(horz, vert); } else { this.moveStraight(direction); } }; Game_Player.prototype.moveDiagonally = function (horz, vert) { if (this.canPassDiagonally(this.x, this.y, horz, vert)) { this._followers.updateMove(); Game_Character.prototype.moveDiagonally.call(this, horz, vert); } else { var dir = this._direction === horz ? [vert, horz] : [horz, vert]; this.moveStraight(dir[0]); if (!this.isMovementSucceeded()) { this.moveStraight(dir[1]); } } }; Game_Player.prototype.canPassDiagonally = function (x, y, horz, vert) { var x2 = $gameMap.roundXWithDirection(x, horz); var y2 = $gameMap.roundYWithDirection(y, vert); return ( this.canPass(x, y, vert) && this.canPass(x, y2, horz) && this.canPass(x, y, horz) && this.canPass(x2, y, vert) ); }; })();