class Scene_Opening
def initialize
@fades_in = []
@fades_in[0] = 60
@fades_in[1] = 60
@fades_in[2] = 60
@fades_in[3] = 30 #enter fade in
@fades_in[4] = 30 #enter flash in
@fades_out = []
@fades_out[3] = 30 #enter fade out
@fades_out[4] = 30 #inter flash out
@pathname = 'Graphics/Titles/'
end
def main
@picture = []
@picture[0] = Sprite.new
@picture[1] = Sprite.new
@picture[2] = Sprite.new
@picture[0].bitmap = Bitmap.new(@pathname + 'backGround')
@picture[1].bitmap = Bitmap.new(@pathname + 'Press Enter')
@picture[2].bitmap = Bitmap.new(@pathname + 'Logo')
for i in 0...@picture.length
@picture[i].ox = 0
@picture[i].oy = 0
# Center sprite on screen
@picture[i].x = 0
@picture[i].y = 0
@picture[i].opacity = 0
end
@bg_fade = true
@logo_fade = false
@loop_enter = false
loop do
Graphics.update
Input.update
frame_update
break if $scene != self
end
Graphics.freeze
for i in 0...@picture.length
@picture[i].dispose
end
end
def frame_update
for i in 0...@picture.length
@picture[i].update
end
if @bg_fade
if @picture[0].opacity < 255
@picture[0].opacity += 255/@fades_in[0]
if @picture[0].opacity >= 255
@intro_fade = false
@picture[0].opacity = 255
@logo_fade = true
end
end
return
end
if @logo_fade
if @picture[2].opacity < 255
@picture[2].opacity += 255/@fades_in[2]
if @picture[2].opacity >= 255
@logo_fade = false
@picture[2].opacity = 255
@enter_fade = true
end
end
return
end
if @enter_fade
if @picture[1].opacity < 255
@picture[1].opacity += 255/@fades_in[1]
if @picture[1].opacity >= 255
@enter_fade = false
@picture[1].opacity = 255
@loop_enter = true
end
end
return
end
if @animate_enter
if @enter_darker
@picture[1].opacity -= 255/@fades_out[4]
if @picture[1].opacity == 0
@flash_loop += 1
@enter_darker = false
end
else
@picture[1].opacity += 255/@fades_out[4]
if @picture[1].opacity == 255
@flash_loop += 1
@enter_darker = true
end
end
if @flash_loop >= 5
$scene = Scene_Connect.new
end
return
end
if @loop_enter
update_enter
update_inputs
end
end
def update_enter
if @wait > 0
@wait -= 1
return
end
if @fading_in_enter
@picture[1].opacity += 255/@fades_in[3]
if @picture[1].opacity >= 255
@picture[1].opacity = 255
@fading_out_enter = false
end
else
@picture[1].opacity -= 255/@fades_out[3]
if @picture[1].opacity <= 0
@picture[1].opacity = 0
@fading_out_enter = true
end
end
return
end
def update_inputs
if Input.triggerd(Input::C) and @animate_enter != true
Audio.se_play(SE_NAME,SE_VOL_SE_PITCH) if SE_NAME != ''
@animate_enter = true
end
end
end