#============================================================================== # • Scene_Loading #============================================================================== # Autor: Dax # Versão: 1.0 # Site: www.dax-soft.weebly.com # Requerimento: N/A #============================================================================== # • Descrição: #------------------------------------------------------------------------------ # Uma simples tela de loading, com alguns efeitos bacana. # Para chamar : SceneManager.call(Scene_Loading) #============================================================================== class Scene_Loading < Scene_Base #---------------------------------------------------------------------------- # • Constante #---------------------------------------------------------------------------- TIME = 5 # Configure aqui o tempo. LIMIT_RAND = 5 # Limite do tempo. #---------------------------------------------------------------------------- # • Processo principal #---------------------------------------------------------------------------- def main super end #---------------------------------------------------------------------------- # • Inicialização dos objetos #---------------------------------------------------------------------------- def start @sprite = Array.new (0..12).each do |index| @sprite[index] = Sprite.new @sprite[index].y = 416-36 @sprite[index].x = 300 + (index * 14) @sprite[index].bitmap = Bitmap.new(18, 18) @sprite[index].bitmap.font.size = 18 end ["C", "a", "r", "r", "e", "g","a", "n", "d", "o", ".", ".", "."].each_with_index do |s, i| @sprite[i].bitmap.draw_text(0, 0, 18, 18, s) end @switche = false @time = 0 @rand = rand(LIMIT_RAND) @rand = 2 if @rand < 1 end #---------------------------------------------------------------------------- # • Renovação dos objetos #---------------------------------------------------------------------------- def terminate @sprite.each(&:dispose) end #---------------------------------------------------------------------------- # • Atualização dos objetos #---------------------------------------------------------------------------- def update Graphics.update Input.update (0..12).each { |i| unless @switche @time = @time + 1 @sprite[i].opacity <= 255 ? @sprite[i].opacity += TIME : @sprite[i].opacity = 255 @sprite[i].angle += TIME unless @sprite[i].angle >= 360 @switche = @sprite[i].angle >= 360 else @time = @time + 1 @sprite[i].opacity >= 0 ? @sprite[i].opacity -= TIME : @sprite[i].opacity = 0 if @sprite[i].opacity <= 0 @sprite[i].angle = 0 @switche = false end end } SceneManager.return if @time > 5000*@rand end end