设为首页收藏本站|繁體中文

Project1

 找回密码
 注册会员
搜索
查看: 25|回复: 0
打印 上一主题 下一主题

[原创发布] 流沙脚步声插件与Sanshiro的AnalogMove插件的兼容补丁

[复制链接]

Lv4.逐梦者

梦石
0
星屑
5156
在线时间
113 小时
注册时间
2023-2-9
帖子
29
跳转到指定楼层
1
发表于 前天 21:42 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式

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

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

x
本帖最后由 1101340379 于 2025-5-11 21:59 编辑

用deepseek进行了多次尝试,现已兼容SAN_AnalogMove 3.1.5版本。
直接在Ryusa_FootstepSE插件的代码底部进行替换。
把Ryusa_FootstepSE插件放置在下方。

JAVASCRIPT 代码复制
  1. // Sanshiro 的 Analog Move 兼容补丁
  2. //-----------------------------------------------------------------------------
  3. if (Imported.SAN_AnalogMove && Ryusa_Footstep_SE._analogmove_patch) {
  4.     // 保存原始方法
  5.     var _Game_Player_updateAnalogMove = Game_Player.prototype.updateAnalogMove;
  6.  
  7.     // 重写updateAnalogMove方法
  8.     Game_Player.prototype.updateAnalogMove = function() {
  9.         _Game_Player_updateAnalogMove.call(this);
  10.  
  11.         if (!Ryusa_Footstep_SE.enable() || !this.canMove()) return;
  12.  
  13.         // 初始化计数器
  14.         this._footstepCounter = this._footstepCounter || 0;
  15.  
  16.         // 获取移动距离
  17.         var movedDistance = this._mover ? this._mover.distanceMoved() : 0;
  18.         movedDistance = Math.max(0, Math.min(movedDistance, 1)); // 限制在0-1之间
  19.  
  20.         // 如果正在移动
  21.         if (this.isMoving() && movedDistance > 0) {
  22.             // 更新步数计数器
  23.             this._footstepCounter += movedDistance;
  24.  
  25.             // 根据是否冲刺决定步频
  26.             var stepThreshold = this.isDashing() ?
  27.                 (1 / Ryusa_Footstep_SE._dashing_hotfix) :
  28.                 (1 / Ryusa_Footstep_SE._walking_hotfix);
  29.  
  30.             // 当累计步数超过阈值时播放声音
  31.             while (this._footstepCounter >= stepThreshold) {
  32.                 Ryusa_Footstep_SE.play();
  33.                 this._footstepCounter -= stepThreshold;
  34.             }
  35.         } else {
  36.             this._footstepCounter = 0;
  37.         }
  38.     };
  39.  
  40.     // 确保计数器初始化
  41.     var _Game_Player_initMembers = Game_Player.prototype.initMembers;
  42.     Game_Player.prototype.initMembers = function() {
  43.         _Game_Player_initMembers.call(this);
  44.         this._footstepCounter = 0;
  45.     };
  46. }

评分

参与人数 1+1 收起 理由
马铃薯条 + 1 我很赞同

查看全部评分

全栈独游制作,喜欢使用龙骨精灵。
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

拿上你的纸笔,建造一个属于你的梦想世界,加入吧。
 注册会员
找回密码

站长信箱:[email protected]|手机版|小黑屋|无图版|Project1游戏制作

GMT+8, 2025-5-13 05:41

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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