【Akahara】画面动画只播放一次
修复一个问题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
returnunless 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)unless@hide == true
@animation.timings.eachdo |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.playunless hide == true || @ani_duplicated
case timing.flash_scope
when1
self.flash(timing.flash_color, timing.flash_duration * @ani_rate)
when2
if viewport && !@ani_duplicated
viewport.flash(timing.flash_color, timing.flash_duration * @ani_rate)unless hide == true
end
when3
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
if animation
targets.each_with_indexdo |target,index|
target.hide_animation = trueif animation.to_screen? && target != targets
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
https://rpg.blue/data/attachment/forum/202311/05/210523anbyd7jbbbbdbysj.png 解决了rm默认播放画面动画多个敌人会重复播放导致重叠很丑的问题https://rpg.blue/static/image/smiley/guapi/guapi6.jpg
本帖来自P1论坛作者sxjkjly8010,因Project1站服务器在国外有时候访问缓慢不方便作者交流学习,经联系P1站长fux2同意署名转载一起分享游戏制作经验,共同为国内独立游戏作者共同创造良好交流环境,原文地址:https://rpg.blue/forum.php?mod=viewthread&tid=494736若有侵权,发帖作者可联系底部站长QQ在线咨询功能删除,谢谢。
页:
[1]