作ってみました。あってるかな…
歩行グラフィックを決まった並びというか方向というかで作る必要があります。
↘↘↘
↙↙↙
↗↗↗
↖ ↖ ↖
内部的なキャラクターの向きと画像のパターンが一致しないので
若干キモチワルイ場面もあるかもしれません。イベントコマンドで向き変更した場合とか…
画像のパターンを直接変更するには
コード: 全て選択
$gamePlayer.setSpriteDirection(2) // プレイヤーを↘向きに
$gameMap.event(id).setSpriteDirection(4) // イベントを↙向きに
とかで出来ます。ただし向き固定されている場合は効きません。
2 : ↘
4 : ↙
6 : ↗
8 : ↖
画像は素材ではないですが…
必要なら動作確認用にのみお使いください。
コード: 全て選択
(() => {
"use strict";
//=============================================================================
// Game_CharacterBase
//=============================================================================
// this._spriteDirection = 2 : ↘
// this._spriteDirection = 4 : ↙
// this._spriteDirection = 6 : ↗
// this._spriteDirection = 8 : ↖
const _Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function() {
_Game_CharacterBase_initMembers.call(this);
this._spriteDirection = 2;
};
Game_CharacterBase.prototype.spriteDirection = function() {
return this._spriteDirection;
};
Game_CharacterBase.prototype.setSpriteDirection = function(d, auto) {
if (this.isDirectionFixed()) {
return;
}
if (auto) {
if (this._spriteDirection === 2) {
if (d === 4) this._spriteDirection = 4;
if (d === 8) this._spriteDirection = 6;
}
if (this._spriteDirection === 4) {
if (d === 6) this._spriteDirection = 2;
if (d === 8) this._spriteDirection = 8;
}
if (this._spriteDirection === 6) {
if (d === 4) this._spriteDirection = 8;
if (d === 2) this._spriteDirection = 2;
}
if (this._spriteDirection === 8) {
if (d === 6) this._spriteDirection = 6;
if (d === 2) this._spriteDirection = 4;
}
} else {
this._spriteDirection = d;
}
};
const _Game_CharacterBase_setDirection = Game_CharacterBase.prototype.setDirection;
Game_CharacterBase.prototype.setDirection = function(d) {
this.setSpriteDirection(d, true);
_Game_CharacterBase_setDirection.call(this, d);
};
//=============================================================================
// Sprite_Character
//=============================================================================
// override
Sprite_Character.prototype.characterPatternY = function() {
// return (this._character.direction() - 2) / 2;
return (this._character.spriteDirection() - 2) / 2;
};
})();