def showed?
@time == @duration - 1 || self.opacity == 0
end
end
@sprite.duration = duration
end
end
class << Graphics
alias update_for_screen_flash update
def update
update_for_screen_flash
if (sprite = Screen.sprite)
sprite.update_opacity
Screen.sprite = nil if sprite.showed?
end
end
end[/pre]
一个使用范例:
[pre lang="ruby"]class Scene_Menu
alias start_for_screen start
def start
start_for_screen
Screen.start_flash(Color.new(255,0,0), 60)
end
end
[/pre]