查看: 1956|回复: 1

[原创发布] 【Akahara】画面动画只播放一次

[复制链接]
梦石
0
星屑
1581
在线时间
253 小时
注册时间
2019-4-11
回帖
32
发表于 2023-11-5 21:06:24 | 显示全部楼层 |阅读模式

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

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

×
本帖最后由 sxjkjly8010 于 2023-11-13 21:32 编辑

修复一个问题

[pre lang="ruby"]#==============================================================================
# ■ 画面动画只播放一次 By:Akahara
#------------------------------------------------------------------------------
#
#  由于进行了重定义建议放在插件脚本位置较前的地方
#
#  解决了多个敌人播放画面动画会重叠好几次的问题
#  第一个目标不变
#  其他目标时“闪烁目标”,“隐藏目标”会照常播放
#  “播放se”,“闪烁画面”不会播放
#
#------------------------------------------------------------------------------

class Game_Battler < Game_BattlerBase
  attr_accessor :hide_animation
  alias akahara_hidea_initialize initialize
  def initialize
    @hide_animation = false
    akahara_hidea_initialize
  end
end

class Sprite_Base < Sprite
  def start_animation(animation, mirror = false, hide = false)
    dispose_animation
    @hide = hide
    @animation = animation
    if @animation
      @ani_mirror = mirror
      set_animation_rate
      @ani_duration = @animation.frame_max * @ani_rate + 1
      load_animation_bitmap
      make_animation_sprites
      set_animation_origin
    end
  end
  def update_animation
    return unless animation?
    @ani_duration -= 1
    if @ani_duration % @ani_rate == 0
      if @ani_duration > 0
        frame_index = @animation.frame_max
        frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
        animation_set_sprites(@animation.frames[frame_index]) unless @hide == true
        @animation.timings.each do |timing|
          animation_process_timing(timing, @hide) if timing.frame == frame_index
        end
      else
        end_animation
      end
    end
  end
  def animation_process_timing(timing, hide = false)
    timing.se.play unless hide == true || @ani_duplicated
    case timing.flash_scope
    when 1
      self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
    when 2
      if viewport && !@ani_duplicated
        viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate) unless hide == true
      end
    when 3
      self.flash(nil, timing.flash_duration * @ani_rate)
    end
  end
end

class Sprite_Battler < Sprite_Base
  def setup_new_animation
    if @battler.animation_id > 0
      animation = $data_animations[@battler.animation_id]
      mirror = @battler.animation_mirror
      hide = @battler.hide_animation
      start_animation(animation, mirror, hide)
      @battler.hide_animation = false
      @battler.animation_id = 0
    end
  end
end

class Scene_Battle < Scene_Base
  def show_normal_animation(targets, animation_id, mirror = false)
    animation = $data_animations[animation_id]
    if animation
      targets.each_with_index do |target,index|
        target.hide_animation = true if animation.to_screen? && target != targets[0]
        target.animation_id = animation_id
        target.animation_mirror = mirror
        abs_wait_short unless animation.to_screen?
      end
      abs_wait_short if animation.to_screen?
    end
  end
end[/pre]

QQ截图20231105210219.png 解决了rm默认播放画面动画多个敌人会重复播放导致重叠很丑的问题
梦石
0
星屑
787
在线时间
81 小时
注册时间
2025-7-10
回帖
6
发表于 2026-4-21 22:20:43 | 显示全部楼层
强
回复

使用道具 举报

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

本版积分规则

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

在本版发帖返回顶部