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

Project1

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

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

[复制链接]

Lv2.观梦者

梦石
0
星屑
877
在线时间
195 小时
注册时间
2019-4-11
帖子
56
跳转到指定楼层
1
发表于 2023-11-5 21:06:24 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式

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

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

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

修复一个问题

RUBY 代码复制
  1. #==============================================================================
  2. # ■ 画面动画只播放一次 By:Akahara
  3. #------------------------------------------------------------------------------
  4. #
  5. #  由于进行了重定义建议放在插件脚本位置较前的地方
  6. #
  7. #  解决了多个敌人播放画面动画会重叠好几次的问题
  8. #  第一个目标不变
  9. #  其他目标时“闪烁目标”,“隐藏目标”会照常播放
  10. #  “播放se”,“闪烁画面”不会播放
  11. #
  12. #------------------------------------------------------------------------------
  13.  
  14. class Game_Battler < Game_BattlerBase
  15.   attr_accessor :hide_animation
  16.   alias akahara_hidea_initialize initialize
  17.   def initialize
  18.     @hide_animation = false
  19.     akahara_hidea_initialize
  20.   end
  21. end
  22.  
  23. class Sprite_Base < Sprite
  24.   def start_animation(animation, mirror = false, hide = false)
  25.     dispose_animation
  26.     @hide = hide
  27.     @animation = animation
  28.     if @animation
  29.       @ani_mirror = mirror
  30.       set_animation_rate
  31.       @ani_duration = @animation.frame_max * @ani_rate + 1
  32.       load_animation_bitmap
  33.       make_animation_sprites
  34.       set_animation_origin
  35.     end
  36.   end
  37.   def update_animation
  38.     return unless animation?
  39.     @ani_duration -= 1
  40.     if @ani_duration % @ani_rate == 0
  41.       if @ani_duration > 0
  42.         frame_index = @animation.frame_max
  43.         frame_index -= (@ani_duration + @ani_rate - 1) / @ani_rate
  44.         animation_set_sprites(@animation.frames[frame_index]) unless @hide == true
  45.         @animation.timings.each do |timing|
  46.           animation_process_timing(timing, @hide) if timing.frame == frame_index
  47.         end
  48.       else
  49.         end_animation
  50.       end
  51.     end
  52.   end
  53.   def animation_process_timing(timing, hide = false)
  54.     timing.se.play unless hide == true || @ani_duplicated
  55.     case timing.flash_scope
  56.     when 1
  57.       self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
  58.     when 2
  59.       if viewport && !@ani_duplicated
  60.         viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate) unless hide == true
  61.       end
  62.     when 3
  63.       self.flash(nil, timing.flash_duration * @ani_rate)
  64.     end
  65.   end
  66. end
  67.  
  68. class Sprite_Battler < Sprite_Base
  69.   def setup_new_animation
  70.     if @battler.animation_id > 0
  71.       animation = $data_animations[@battler.animation_id]
  72.       mirror = @battler.animation_mirror
  73.       hide = @battler.hide_animation
  74.       start_animation(animation, mirror, hide)
  75.       @battler.hide_animation = false
  76.       @battler.animation_id = 0
  77.     end
  78.   end
  79. end
  80.  
  81. class Scene_Battle < Scene_Base
  82.   def show_normal_animation(targets, animation_id, mirror = false)
  83.     animation = $data_animations[animation_id]
  84.     if animation
  85.       targets.each_with_index do |target,index|
  86.         target.hide_animation = true if animation.to_screen? && target != targets[0]
  87.         target.animation_id = animation_id
  88.         target.animation_mirror = mirror
  89.         abs_wait_short unless animation.to_screen?
  90.       end
  91.       abs_wait_short if animation.to_screen?
  92.     end
  93.   end
  94. end


解决了rm默认播放画面动画多个敌人会重复播放导致重叠很丑的问题
您需要登录后才可以回帖 登录 | 注册会员

本版积分规则

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

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

GMT+8, 2024-4-30 10:10

Powered by Discuz! X3.1

© 2001-2013 Comsenz Inc.

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