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

[转载发布] Character's Dash Animation

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

    连续签到: 2 天

    [LV.7]常住居民III

    9071

    主题

    864

    回帖

    6万

    积分

    管理员

    Rank: 9Rank: 9Rank: 9

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

    灌水之王

    发表于 2026-8-3 13:03:46 | 显示全部楼层 |阅读模式
    Character's Dash Animation
    2 Versions

    by Kyonides


    Introduction

    This is pretty much a plug & play script that will allow you to change the dash animation of the whole party. You must have an extra character spritesheet and name it something like "original_sheet1_dash.png", being "original_sheet1" the actual filename of the original actor spriteset. Then the script will switch from one to another in no time depending on the Dash button and any arrow key or its equivalent.

    The Original Script - Updated

    Spoiler                Ruby:       
    1. # * Character's Dash Animation * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2025-07-16
    4. # You will need some extra character spritesheets to make it work.
    5. # Their filenames should include the _dash suffix or they will be ignored.
    6. # It will crash if you never move them in the Graphics/Characters directory.
    7. class Game_Character
    8.   def actor?
    9.     false
    10.   end
    11. end
    12. class Game_Player
    13.   def actor?
    14.     true
    15.   end
    16. end
    17. class Game_Follower
    18.   def actor?
    19.     true
    20.   end
    21. end
    22. class Sprite_Character
    23.   DASH_SUFFIX = "_dash"
    24.   alias :kyon_char_dash_anime_sprt_char_up_bit :update_bitmap
    25.   def initialize(viewport, character=nil)
    26.     super(viewport)
    27.     @character = character
    28.     @party_member = character.actor?
    29.     @balloon_duration = 0
    30.     update
    31.   end
    32.   def update_bitmap
    33.     if @party_member
    34.       bitmap_update
    35.     else
    36.       kyon_char_dash_anime_sprt_char_up_bit
    37.     end
    38.   end
    39.   def bitmap_update
    40.     dashing = ($game_player.dash? && Input.dir4 > 0)
    41.     if graphic_changed? or dashing != @dashing
    42.       @dashing = dashing
    43.       @tile_id = @character.tile_id
    44.       @character_name = @character.character_name
    45.       @character_name += DASH_SUFFIX if !@character_name.empty? && @dashing
    46.       @character_index = @character.character_index
    47.       if @tile_id > 0
    48.         set_tile_bitmap
    49.       else
    50.         set_character_bitmap
    51.       end
    52.     end
    53.   end
    54. end
    复制代码






    The Editable Map Dash Add-On
    It lets you alter a map's dashing feature without altering the original map data.
    Spoiler: Add-On
                    Ruby:       
    1. # * Character's Dash Animation - Editable Dash Add-On * #
    2. #   Scripter : Kyonides Arkanthes
    3. #   2025-07-16
    4. # * Script Calls * #
    5. # To Disable Dashing:
    6. #   $game_map.disable_dashing = true
    7. # To Use the Usual Map Dashing Setup:
    8. #   $game_map.disable_dashing = nil
    9. class Game_Map
    10.   attr_accessor :disable_dashing
    11.   def disable_dash?
    12.     @disable_dashing || @map.disable_dashing
    13.   end
    14. end
    复制代码


    The Omega Orca Edition
    Basically, the only new feature it includes is that it lets you add 1 or more horizontal frames to a given character's spritesheet, and adds the new pattern_max variable so it never skips any of the extra frames while updating the animation.
    Now it also affects all window classes by overwriting the draw_character method.

    Spoiler                Ruby:       
    1. # * Character's Dash Animation * #
    2. # - Omega Orca Edition - #
    3. #   Scripter : Kyonides Arkanthes
    4. #   v0.5.0 - 2025-03-15
    5. # You will need some extra character spritesheets to make it work.
    6. # Their filenames should include the _dash suffix or they will be ignored.
    7. # It will crash if you never move them in the Graphics/Characters directory.
    8. # Overwritten Methods:
    9. # Window_Base#draw_character
    10. # Sprite_Character#set_character_bitmap and #update_src_rect
    11. module DashCharSetup
    12.   WIDTH_MAX_FRAMES = 4
    13.   DASH_SUFFIX = "_dash"
    14. end
    15. class Game_CharacterBase
    16.   alias :kyon_char_dash_anime_gm_charbs_init_pub_mbrs :init_public_members
    17.   def init_public_members
    18.     kyon_char_dash_anime_gm_charbs_init_pub_mbrs
    19.     @pattern_max = DashCharSetup::WIDTH_MAX_FRAMES + 1
    20.   end
    21.   def update_anime_pattern
    22.     if !@step_anime && @stop_count > 0
    23.       @pattern = @original_pattern
    24.     else
    25.       @pattern = (@pattern + 1) % @pattern_max
    26.     end
    27.   end
    28.   attr_reader :pattern_max
    29. end
    30. class Game_Character
    31.   def actor?
    32.     false
    33.   end
    34. end
    35. class Game_Player
    36.   def actor?
    37.     true
    38.   end
    39. end
    40. class Game_Follower
    41.   def actor?
    42.     true
    43.   end
    44. end
    45. class Window_Base
    46.   def draw_character(character_name, character_index, x, y)
    47.     return unless character_name
    48.     @width_frames ||= DashCharSetup::WIDTH_MAX_FRAMES
    49.     bitmap = Cache.character(character_name)
    50.     sign = character_name[/^[\!\$]./]
    51.     if sign && sign.include?('$')
    52.       cw = bitmap.width / @width_frames
    53.       ch = bitmap.height / 4
    54.     else
    55.       cw = bitmap.width / @width_frames * 4
    56.       ch = bitmap.height / 8
    57.     end
    58.     n = character_index
    59.     cx = (n % 4 * @width_frames + 1) * cw
    60.     cy = (n / 4 * 4) * ch
    61.     src_rect = Rect.new(cx, @width_frames, cw, ch)
    62.     contents.blt(x - cw / 2, y - ch, bitmap, src_rect)
    63.   end
    64. end
    65. class Sprite_Character
    66.   include DashCharSetup
    67.   alias :kyon_char_dash_anime_sprt_char_up_bit :update_bitmap
    68.   def initialize(viewport, character=nil)
    69.     super(viewport)
    70.     @character = character
    71.     @party_member = character.actor?
    72.     @balloon_duration = 0
    73.     @width_frames = WIDTH_MAX_FRAMES
    74.     update
    75.   end
    76.   def update_bitmap
    77.     if @party_member
    78.       bitmap_update
    79.     else
    80.       kyon_char_dash_anime_sprt_char_up_bit
    81.     end
    82.   end
    83.   def bitmap_update
    84.     dashing = ($game_player.dash? && Input.dir4 > 0)
    85.     if graphic_changed? or dashing != @dashing
    86.       @dashing = dashing
    87.       @tile_id = @character.tile_id
    88.       @character_name = @character.character_name
    89.       @character_name += DASH_SUFFIX if !@character_name.empty? && @dashing
    90.       @character_index = @character.character_index
    91.       if @tile_id > 0
    92.         set_tile_bitmap
    93.       else
    94.         set_character_bitmap
    95.       end
    96.     end
    97.   end
    98.   def set_character_bitmap
    99.     self.bitmap = Cache.character(@character_name)
    100.     sign = @character_name[/^[\!\$]./]
    101.     if sign && sign.include?('$')
    102.       @cw = bitmap.width / @width_frames
    103.       @ch = bitmap.height / 4
    104.     else
    105.       @cw = bitmap.width / @width_frames * 4
    106.       @ch = bitmap.height / 8
    107.     end
    108.     self.ox = @cw / 2
    109.     self.oy = @ch
    110.   end
    111.   def update_src_rect
    112.     return if @tile_id != 0
    113.     index = @character.character_index
    114.     pattern = @character.pattern < @width_frames ? @character.pattern : 1
    115.     sx = (index % 4 * @width_frames + pattern) * @cw
    116.     sy = (index / 4 * 4 + (@character.direction - 2) / 2) * @ch
    117.     self.src_rect.set(sx, sy, @cw, @ch)
    118.   end
    119. end
    复制代码






    Terms & Conditions

    Free for use in ANY game.
    Due credit is mandatory.
    Miss the eclipse on April 8th. [Yes, it's a joke.]
    That's it!



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

    本帖子中包含更多资源

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

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

    使用道具 举报

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

    本版积分规则

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

    幸运抽奖

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

    立即查看

    聊天机器人
    Loading...

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

    GMT+8, 2026-8-17 06:17 , Processed in 0.067103 second(s), 52 queries .

    Powered by Discuz! X3.4

    Copyright © 2001-2020, Tencent Cloud.

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