扫描二维码关注官方公众号
返回列表
+ 发新帖
查看: 122|回复: 0

[转载发布] 冲刺过长时间角色疲惫插件

[复制链接]
累计送礼:
0 个
累计收礼:
0 个
  • TA的每日心情
    开心
    2025-2-4 02:05
  • 签到天数: 110 天

    连续签到: 2 天

    [LV.6]常住居民II

    2327

    主题

    395

    回帖

    1万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

    VIP
    6
    卡币
    10465
    OK点
    16
    推广点
    0
    同能卷
    0
    积分
    13215

    灌水之王

    发表于 2024-11-22 05:07:36 | 显示全部楼层 |阅读模式
    看到有人需要类似的功能就顺手写了一个插件!
    冲刺过长时间,角色会减速。当取消冲刺状态或停止后下来会自动恢复耐力!
    冲刺的加速度及减速度会均匀增加,陷入疲惫状态会有气泡提示!

    JAVASCRIPT 代码下载
    1. /*:
    2. * Acceleration.js
    3. * @plugindesc 均匀加减速插件
    4. * @author 魏玉龙
    5. * @since 2018.09.15
    6. * @version 1.0
    7. *
    8. * @param speed
    9. * @desc 加速度
    10. * @default 0.01
    11. *
    12. * @param stamina
    13. * @desc 角色冲刺持续帧数,为0时可无限时冲刺。
    14. * @default 600
    15. *
    16. */
    17. (function(){
    18.     var parameters = PluginManager.parameters('Acceleration');
    19.     var speed = Number(parameters['speed'] || 0.01);
    20.     var stamina = Number(parameters['stamina'] || 600);
    21.     var Game_CharacterBase_prototype_initMembers = Game_CharacterBase.prototype.initMembers;
    22.     Game_CharacterBase.prototype.initMembers = function(){
    23.         Game_CharacterBase_prototype_initMembers.call(this);
    24.         this._dashSpeed = 0;
    25.         this._stamina = stamina;
    26.     }
    27.     Game_CharacterBase.prototype.realMoveSpeed = function(){
    28.         returnthis._moveSpeed + this._dashSpeed;
    29.     }
    30.     var Game_CharacterBase_prototype_updateStop = Game_CharacterBase.prototype.updateStop;
    31.     Game_CharacterBase.prototype.updateStop = function(){
    32.         Game_CharacterBase_prototype_updateStop.call(this);
    33.         if(this._dashSpeed != 0){
    34.             this._dashSpeed = 0;
    35.         }
    36.         if(this._stamina < stamina){
    37.             this._stamina++;
    38.         }
    39.     }
    40.     var Game_CharacterBase_prototype_updateMove = Game_CharacterBase.prototype.updateMove;
    41.     Game_CharacterBase.prototype.updateMove = function(){
    42.         Game_CharacterBase_prototype_updateMove.call(this);
    43.         this.updateDashSpeed();
    44.     }
    45.     Game_CharacterBase.prototype.updateDashSpeed = function(){
    46.         if(this.isDashing()){
    47.             if(this._stamina > 0 || stamina == 0){
    48.                 this._dashSpeed = Math.min(this._dashSpeed + speed, 1);
    49.                 this._stamina > 0 && this._stamina--;
    50.             }else{
    51.                 if(this._stamina == 0 && this._dashSpeed == 1){
    52.                     this.requestBalloon(7);
    53.                 }
    54.                 this._dashSpeed = Math.max(this._dashSpeed - speed, -1);
    55.             }
    56.         }else{
    57.             if(this._dashSpeed > 0){
    58.                 this._dashSpeed = Math.max(this._dashSpeed - speed, 0);
    59.             }else{
    60.                 this._dashSpeed = Math.min(this._dashSpeed + speed, 0);
    61.             }
    62.             if(this._stamina < stamina){
    63.                 this._stamina++;
    64.             }
    65.         }
    66.     }
    67. })();
    复制代码

                本帖来自P1论坛作者魏玉龙,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=410173  若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
    天天去同能,天天有童年!
    回复 送礼论坛版权

    使用道具 举报

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

    本版积分规则

    关闭

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2025-3-10 11:36 , Processed in 0.108661 second(s), 54 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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