查看: 1062|回复: 3

[有事请教] 关于行走图

[复制链接]
梦石
0
星屑
94
在线时间
6 小时
注册时间
2025-3-31
回帖
2
发表于 2025-10-31 15:08:15 | 显示全部楼层 |阅读模式

加入我们,或者,欢迎回来。

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

×
求助,有没有办法让向下左右四个行走图,更换为左右两个45度的图,比如:

左行后上下是左方向图,切换右行后,上下就显示右方向图~
梦石
0
星屑
29896
在线时间
5733 小时
注册时间
2016-3-8
回帖
1653
发表于 2025-11-1 01:07:59 | 显示全部楼层
本帖最后由 alexncf125 于 2025-11-1 01:50 编辑

这版是完全禁掉了任何上下朝向的, 要是你有其他要求可再作提出, 比如只需要禁掉玩家操控的角色, 或者禁掉上下朝向但保留上下朝向的判定

[pre lang="ruby"]//=============================================================================
// MovePlayerLikeDnf.js
// ----------------------------------------------------------------------------
// Version
// 1.0.0 2025/11/01 初版
//=============================================================================

var Imported = Imported || {};
Imported.KN_MovePlayerLikeDnf = true;

var KN = KN || {};
KN.MPLD = KN.MPLD || {};
KN.MPLD.version = 1.00;
KN.MPLD.pluginName = document.currentScript.src.match(/([^\/]+)\.js/)[1];

/*:
* @plugindesc 人物的移动方式会像DNF那样子
* @target MZ
* @url https://rpg.blue/thread-498236-1-1.html
* @author 佚名
*
* @param InitDirectionMPLD
* @text 初始朝向
* @desc 第一次进行游戏时, 玩家面朝的方向
* @default 2
* @type number
*
* @param SwitchDisableMPLD
* @text 停用开关
* @desc 开关打开时, 此插件的功能就会暂停运作
* @default 0
* @type switch
*
* @help MovePlayerLikeDnf.js
* 左行后上下是左方向图,切换右行后,上下就显示右方向图~
*/

//=============================================================================
// Parameter Variables
//=============================================================================

KN.Parameters = PluginManager.parameters(KN.MPLD.pluginName);
KN.Param = KN.Param || {};

KN.Param.InitDirectionMPLD = parseInt(KN.Parameters['InitDirectionMPLD']);
KN.Param.SwitchDisableMPLD = KN.Parameters['SwitchDisableMPLD'];

const _alias_20251101_Game_CharacterBase_initMembers = Game_CharacterBase.prototype.initMembers;
Game_CharacterBase.prototype.initMembers = function () {
    _alias_20251101_Game_CharacterBase_initMembers.apply(this, arguments);
    if (this instanceof Game_Player) {
        this._previousDirection = this._direction = KN.Param.InitDirectionMPLD;
    } else {
        this._previousDirection = this._direction;
    }
};

const _alias_20251101_Game_CharacterBase_setDirection = Game_CharacterBase.prototype.setDirection;
Game_CharacterBase.prototype.setDirection = function (d) {
    if (!$gameSwitches.value(KN.Param.SwitchDisableMPLD)) {
        const dir = this.direction();
        if (dir > 2 && dir < 8) this._previousDirection = dir;
        if (d === 2 || d === 8) {
            if ([4, 6].contains(this._previousDirection)) {
                d = this._previousDirection;
            }
        }
    }
    _alias_20251101_Game_CharacterBase_setDirection.call(this, d);
};

[/pre]
回复 1 0

使用道具 举报

梦石
0
星屑
94
在线时间
6 小时
注册时间
2025-3-31
回帖
2
 楼主| 发表于 2025-11-9 23:25:06 | 显示全部楼层
alexncf125 发表于 2025-11-1 01:07
这版是完全禁掉了任何上下朝向的, 要是你有其他要求可再作提出, 比如只需要禁掉玩家操控的角色, 或者禁掉上 ...

非常感谢~~~~
回复

使用道具 举报

梦石
0
星屑
94
在线时间
6 小时
注册时间
2025-3-31
回帖
2
 楼主| 发表于 2025-11-9 23:41:26 | 显示全部楼层
alexncf125 发表于 2025-11-1 01:07
这版是完全禁掉了任何上下朝向的, 要是你有其他要求可再作提出, 比如只需要禁掉玩家操控的角色, 或者禁掉上 ...

没有什么编程的基础,直接把大佬的代码保存成.js的文件在MZ中加载了,能用~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

Powered by Discuz! X5.0 © 2001-2026 Discuz! Team.

在本版发帖返回顶部