设为首页收藏本站同能贴吧 切换语言 繁体中文
开启辅助访问 切换到窄版
扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 69|回复: 0

[转载发布] 8 Directions graphics plugin

[复制链接]
累计送礼:
0 个
累计收礼:
1 个
  • TA的每日心情
    开心
    2026-7-12 04:10
  • 签到天数: 209 天

    连续签到: 2 天

    [LV.7]常住居民III

    5778

    主题

    864

    回帖

    3万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    7
    卡币
    25563
    OK点
    16
    推广点
    0
    同能卷
    50
    积分
    32235

    灌水之王

    发表于 昨天 16:35 | 显示全部楼层 |阅读模式
    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:       
    1. //=============================================================================
    2. // 8dir_graphics.js
    3. //=============================================================================
    4. /*:
    5. * @plugindesc you can use 8 directions graphics
    6. *
    7. * @author Orcomarcio
    8. *
    9. * @help to use 8 direction graphics:
    10. 1 - insert "8dir" in the name of the file (wherever you want)
    11. 2 - put the 4 diagonal graphics right below the normal cross movement graphics, just as they where an another character
    12. 3 - be sure the diagonal movement graphics are facing directions in this order: South-West, NW, SE, NE
    13. 4 - choose either both top(normal) and bottom(diagonal) graphic sheet for the character, the code accounts for it
    14. 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.
    15.      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
    16. *
    17. * Free for commercial and non commercial use.
    18. */
    19. ImageManager.is8DirCharacter = function(filename) {
    20.     return filename.contains('8dir');
    21. };
    22. var alias_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
    23. Game_CharacterBase.prototype.initMembers = function() {
    24.     alias_Game_CharacterBase_initMembers.call(this); //calls original method
    25.     // added lines
    26.     this._dir8 = this._direction;
    27.     this._isDir8 = false;
    28.     this._originalCharacterIndex;
    29. };
    30. var alias_CharacterBase_update = Game_CharacterBase.prototype.update
    31. Game_CharacterBase.prototype.update = function() {
    32.     alias_CharacterBase_update.call(this); //calls original method
    33.     // added lines
    34.     this.updateDir8();
    35. };
    36. Game_CharacterBase.prototype.setImage = function(characterName, characterIndex) {
    37.     this._tileId = 0;
    38.     this._characterName = characterName;
    39.     this._characterIndex = characterIndex;
    40.     this._isObjectCharacter = ImageManager.isObjectCharacter(characterName);
    41.     // added lines
    42.     this._isDir8 = ImageManager.is8DirCharacter(characterName);
    43.     this._originalCharacterIndex = (this._isDir8 && this._characterIndex > 3) ? this._characterIndex - 4 : this._characterIndex;
    44. };
    45. Game_CharacterBase.prototype.setDirection = function(d) {
    46.     if (!this.isDirectionFixed() && d) {
    47.         var dir4;
    48.         switch (d) {
    49.             case 1:
    50.                 dir4 = 2;
    51.                 break;
    52.             case 3:
    53.                 dir4 = 6;
    54.                 break;
    55.             case 7:
    56.                 dir4 = 4;
    57.                 break;
    58.             case 9:
    59.                 dir4 = 8;
    60.                 break;
    61.             default:
    62.                 dir4 = d;
    63.         }
    64.         this._direction = dir4;
    65.         this._dir8 = d;
    66.     }
    67.     this.resetStopCount();
    68. };
    69. Game_CharacterBase.prototype.updateDir8 = function() {
    70.     if (this._isDir8) {
    71.         if (this._dir8 % 2 == 0) {
    72.             // direzione a croce
    73.             this._characterIndex = this._originalCharacterIndex;
    74.         }
    75.         else {
    76.             // direzione in diagonale
    77.             this._characterIndex = this._originalCharacterIndex + 4;
    78.         }
    79.     }
    80. };
    81. Game_CharacterBase.prototype.moveDiagonally = function(horz, vert) {
    82.     this.setMovementSuccess(this.canPassDiagonally(this._x, this._y, horz, vert));
    83.     if (this.isMovementSucceeded()) {
    84.         this._x = $gameMap.roundXWithDirection(this._x, horz);
    85.         this._y = $gameMap.roundYWithDirection(this._y, vert);
    86.         this._realX = $gameMap.xWithDirection(this._x, this.reverseDir(horz));
    87.         this._realY = $gameMap.yWithDirection(this._y, this.reverseDir(vert));
    88.         this.increaseSteps();
    89.     }
    90.     if (horz == 4) {
    91.         if (vert == 2)  this.setDirection(1);
    92.         else            this.setDirection(7);
    93.     } else {
    94.         if (vert == 2)  this.setDirection(3);
    95.         else            this.setDirection(9);
    96.     }
    97. };
    复制代码




    本贴来自国际rpgmaker官方论坛作者:orcomarcio处,因国际论坛即将永久关站,为了存档多年珍贵资料,署名转载到本论坛存档,由于官方帖子为英文原帖,需要中文翻译请点击论坛顶部切换语言为中文就可以将帖子翻译成中文浏览,方便大家随时查看,原文地址:https://forums.rpgmakerweb.com/threads/8-directions-graphics-plugin.55564/

    本帖子中包含更多资源

    您需要 登录 才可以下载或查看,没有账号?立即注册

    x
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

    文明发言,和谐互动
    文明发言,和谐互动
    高级模式
    您需要登录后才可以回帖 登录 | 立即注册

    本版积分规则

    简体中文
    繁體中文
    English(英语)
    日本語(日语)
    Deutsch(德语)
    Русский язык(俄语)
    بالعربية(阿拉伯语)
    Türkçe(土耳其语)
    Português(葡萄牙语)
    ภาษาไทย(泰国语)
    한어(朝鲜语/韩语)
    Français(法语)
    关闭

    幸运抽奖

    社区每日抽奖来袭,快来试试你是欧皇还是非酋~

    立即查看

    聊天机器人
    Loading...

    QQ|Archiver|手机版|小黑屋|同能RPG制作大师 ( 沪ICP备12027754号-3 )

    GMT+8, 2026-7-26 03:54 , Processed in 0.126908 second(s), 53 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

    快速回复 返回顶部 返回列表