I created this for myself and I thought that I might aswell upload it.
To use it you must:
1 - insert "8dir" in the name of the file (wherever you want)
2 - put the 4 diagonal graphics right below the normal cross movement graphics, just as they where an another character
3 - be sure the diagonal movement graphics are facing directions in this order: South-West, NW, SE, NE
4 - choose either both top(normal) and bottom(diagonal) graphic sheet for the character, the code accounts for it
5 - if you want a cahracter to face a diagonal direction during, for example, a set-mouve-route, just call "this.setDirection(direction_id)" via script.
if you want to know which id(number) stands for which direction just look at your numpad and imagine the character instead of the "5" key
You can find this same instructions also in the plugin help.
Here is an example graphic if you want to see how the 8dr graphic should be like
(ps i didnt' create this graphic, i found it on goole, i just rearranged the sprites and resized the image)

| ---
basically is the standard 4 x 2 character sheet, you just put the diag graphics in the bottom slot.
I hope you'll find this usefull
Plugin code (
dowload here:
View attachment 8dir_graphics.js)
Code:
- //=============================================================================
- // 8dir_graphics.js
- //=============================================================================
- /*:
- * @plugindesc you can use 8 directions graphics
- *
- * @author Orcomarcio
- *
- * @help to use 8 direction graphics:
- 1 - insert "8dir" in the name of the file (wherever you want)
- 2 - put the 4 diagonal graphics right below the normal cross movement graphics, just as they where an another character
- 3 - be sure the diagonal movement graphics are facing directions in this order: South-West, NW, SE, NE
- 4 - choose either both top(normal) and bottom(diagonal) graphic sheet for the character, the code accounts for it
- 5 - if you want a cahracter to face a diagonal direction during, for example, a set-mouve-route, just call "this.setDirection(direction_id)" via script.
- if you want to know which id(number) stands for which direction just look at your numpad and imagine the character instead of the "5" key
- *
- * Free for commercial and non commercial use.
- */
- ImageManager.is8DirCharacter = function(filename) {
- return filename.contains('8dir');
- };
- var alias_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
- Game_CharacterBase.prototype.initMembers = function() {
- alias_Game_CharacterBase_initMembers.call(this); //calls original method
- // added lines
- this._dir8 = this._direction;
- this._isDir8 = false;
- this._originalCharacterIndex;
- };
- var alias_CharacterBase_update = Game_CharacterBase.prototype.update
- Game_CharacterBase.prototype.update = function() {
- alias_CharacterBase_update.call(this); //calls original method
- // added lines
- this.updateDir8();
- };
- Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
- this._tileId = 0;
- this._characterName = characterName;
- this._characterIndex = characterIndex;
- this._isObjectCharacter = ImageManager.isObjectCharacter(characterName);
- // added lines
- this._isDir8 = ImageManager.is8DirCharacter(characterName);
- this._originalCharacterIndex = (this._isDir8 && this._characterIndex > 3) ? this._characterIndex - 4 : this._characterIndex;
- };
- Game_CharacterBase.prototype.setDirection = function(d) {
- if (!this.isDirectionFixed() && d) {
- var dir4;
- switch (d) {
- case 1:
- dir4 = 2;
- break;
- case 3:
- dir4 = 6;
- break;
- case 7:
- dir4 = 4;
- break;
- case 9:
- dir4 = 8;
- break;
- default:
- dir4 = d;
- }
- this._direction = dir4;
- this._dir8 = d;
- }
- this.resetStopCount();
- };
- Game_CharacterBase.prototype.updateDir8 = function() {
- if (this._isDir8) {
- if (this._dir8 % 2 == 0) {
- // direzione a croce
- this._characterIndex = this._originalCharacterIndex;
- }
- else {
- // direzione in diagonale
- this._characterIndex = this._originalCharacterIndex + 4;
- }
- }
- };
- Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
- this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert));
- if (this.isMovementSucceeded()) {
- this._x = $gameMap.roundXWithDirection(this._x, horz);
- this._y = $gameMap.roundYWithDirection(this._y, vert);
- this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz));
- this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert));
- this.increaseSteps();
- }
- if (horz == 4) {
- if (vert == 2) this.setDirection(1);
- else this.setDirection(7);
- } else {
- if (vert == 2) this.setDirection(3);
- else this.setDirection(9);
- }
- };
复制代码
本贴来自国际rpgmaker官方论坛作者:orcomarcio处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:
https://forums.rpgmakerweb.com/threads/8-directions-graphics-plugin.55564/