#==============================================================================# # ** Valkyrie Stories Animated Title #------------------------------------------------------------------------------# # ** Created by : Hanzo Kimura(Dream Core) # ** Ported by : Bravo2Kilo # ** Date ported : 4/11/2012 # ** Version : 1.2 #==============================================================================# # ** Update History # Version 1 - Finished Port and released # Version 1.1 - Fixed Bugs and removed useless parts # Version 1.2 - Added Configuration and removed more useless stuff #==============================================================================# # Configuration Start #------------------------------------------------------------------------------# module VS_TITLE # Cursor SE CURSOR_SE = RPG::SE.new("System_TitleSelect", 80, 150) # Logo Position LOGO_X = 0 # X position LOGO_Y = 0 # Y position # Command Sparkle Viewport x, y, width, height SPARKLE_VIEW = Viewport.new(154, 279, 241, 38) # Command Border Y Position COM_BORDER = 264 # Arrow Speed - speed at which the arrow moves back and forth ARROW_SPEED = 3 # Arrow Move Speed - speed at which the arrow moves to a command's position ARROW_MOVE_SPEED = 10 # Arrow X Position should be a multiple of the ARROW_MOVE_SPEED, if it isn't # set as a multiple it will cause rapid movement of the arrows # Newgame Arrow X Position N_L_ARROW = 120 N_R_ARROW = 390 # Continue Arrow X Position C_L_ARROW = 130 C_R_ARROW = 380 # Exit Arrow X Position E_L_ARROW = 190 E_R_ARROW = 320 # Arrow Y Position ARROW_Y = 279 end # module VS_TITLE #------------------------------------------------------------------------------# # Configuration End #==============================================================================# # Do not edit past this unless you know what your doing. #============================================================================== # ** Scene_Title #------------------------------------------------------------------------------ # This class performs the title screen processing. #============================================================================== class Scene_Title < Scene_Base include VS_TITLE #-------------------------------------------------------------------------- # * Object Initialization #-------------------------------------------------------------------------- def initialize @wavecount = 300 @waveswitch = 0 @sparklespeed1 = 0 @sparklespeed2 = 0 @sparklespeed3 = 0 @sparklespeed4 = 0 @sparklerandom1 = 0 @sparklerandom2 = 0 @sparklerandom3 = 0 @sparklerandom4 = 0 @sparklefade = 0 @arrow_r_count = 0 @arrow_l_count = 0 @arrow_r_move = false @arrow_l_move = false @arrows_x_base_switch = false @arrow_x_check = 0 @arrow_r_x_base1 = 0 @arrow_r_x_base2 = 0 @arrow_l_x_base1 = 0 @arrow_l_x_base2 = 0 @sparklefadeswitch = false @commandpoint = 0 @commandanimate = 0 @flashcount = 0 @glowcount = 0 @glowswitch = false end #-------------------------------------------------------------------------- # * Start processing #-------------------------------------------------------------------------- def start super SceneManager.clear Graphics.freeze check_continue create_background create_command_window play_title_music end #-------------------------------------------------------------------------- # * Get Transition Speed #-------------------------------------------------------------------------- def transition_speed return 20 end #-------------------------------------------------------------------------- # * Termination Processing #-------------------------------------------------------------------------- def terminate super SceneManager.snapshot_for_background dispose_background end #-------------------------------------------------------------------------- # * Frame Update #-------------------------------------------------------------------------- def update super @comsparkle1.ox -= 1 @comsparkle1.oy += 1 @comsparkle2.ox -= 1 @comsparkle2.oy -= 1 @comsparkle3.ox -= 1 if @sparklespeed1 == 5 @sparkle1.oy += 1 @sparklespeed1 = 0 @sparklerandom1 = rand(100) case @sparklerandom1 when 0..35 @sparkle1.ox += 1 when 36..70 @sparkle1.ox -= 1 end else @sparklespeed1 += 1 end if @sparklespeed2 == 4 @sparkle2.oy += 2 @sparklespeed2 = 0 @sparklerandom2 = rand(100) case @sparklerandom2 when 0..99 @sparkle2.ox += 1 end else @sparklespeed2 += 1 end if @sparklespeed3 == 2 @sparkle3.oy += 1 @sparklespeed3 = 0 @sparklerandom3 = rand(100) case @sparklerandom3 when 0..99 @sparkle3.ox -= 1 end else @sparklespeed3 += 1 end if @sparklespeed4 == 10 @sparkle4.oy += 1 @sparklespeed4 = 0 @sparklerandom4 = rand(100) case @sparklerandom4 when 0..99 @sparkle4.ox -= 1 end else @sparklespeed4 += 1 end if @sparklefade == 200 && @sparklefadeswitch == false if @sparkle4.opacity != 0 @sparkle4.opacity -= 1 else @sparklefade = 0 @sparklefadeswitch = true end elsif @sparklefade == 200 && @sparklefadeswitch == true if @sparkle4.opacity != 255 @sparkle4.opacity += 1 else @sparklefade = 0 @sparklefadeswitch = false end else @sparklefade += 1 end #ARROW ANIMATION EFFECT @arrow_r.update @arrow_l.update if @arrows_x_base_switch == false #RIGHT ARROW if @arrow_r_count == 5 && @arrow_r_move == false #Move to right if @arrow_r_x_base1 != @arrow_r.x @arrow_r.x += 1 @arrow_r_count = 0 else @arrow_r_count = 0 @arrow_r_move = true end elsif @arrow_r_count == 5 && @arrow_r_move == true #Move to Left if @arrow_r_x_base2 != @arrow_r.x @arrow_r.x -= 1 @arrow_r_count = 0 else @arrow_r_count = 0 @arrow_r_move = false end else @arrow_r_count += 1 end # LEFT ARROW if @arrow_l_count == 5 && @arrow_l_move == true #Move to right if @arrow_l_x_base1 != @arrow_l.x @arrow_l.x += 1 @arrow_l_count = 0 else @arrow_l_count = 0 @arrow_l_move = false end elsif @arrow_l_count == 5 && @arrow_l_move == false #Move to Left if @arrow_l_x_base2 != @arrow_l.x @arrow_l.x -= 1 @arrow_l_count = 0 else @arrow_l_count = 0 @arrow_l_move = true end else @arrow_l_count += 1 end end #ARROW ADJUSTMENT UPDATE if @arrows_x_base_switch == true @arrow_r_x_base1 = @arrow_r_x_base + ARROW_SPEED @arrow_r_x_base2 = @arrow_r_x_base - ARROW_SPEED @arrow_l_x_base1 = @arrow_l_x_base + ARROW_SPEED @arrow_l_x_base2 = @arrow_l_x_base - ARROW_SPEED if @arrow_x_check != 2 #check if Arrows is in place if @arrow_r.x != @arrow_r_x_base if @arrow_r.x > @arrow_r_x_base @arrow_r.x -= ARROW_MOVE_SPEED elsif @arrow_r.x < @arrow_r_x_base @arrow_r.x += ARROW_MOVE_SPEED end else @arrow_x_check += 1 end if @arrow_l.x != @arrow_l_x_base if @arrow_l.x > @arrow_l_x_base @arrow_l.x -= ARROW_MOVE_SPEED elsif @arrow_l.x < @arrow_l_x_base @arrow_l.x += ARROW_MOVE_SPEED end else @arrow_x_check += 1 end else @arrows_x_base_switch = false end end #LOGO WAVE EFFECT @wavelogo.update if @wavecount == 300 if @waveswitch == 0 && @wavelogo.opacity != 155 @wavelogo.opacity += 1 elsif @waveswitch == 0 && @wavelogo.opacity >= 155 @waveswitch = 1 end if @waveswitch == 1 && @wavelogo.opacity != 0 @wavelogo.opacity -= 1 elsif @waveswitch == 1 && @wavelogo.opacity == 0 @wavecount = 0 @waveswitch = 0 end else @wavecount += 1 end #MENU COMMAND ANIMATION menu_command_update # MENU COMMAND ANIMATION UPDATE @menu.update #FLASH MENU ANIMATION if @flashcount == 120 @menu.flash(Color.new(255,255,255), 20) @flashcount = 0 else @flashcount += 1 end # 0 - NEW GAME # 1 - CONTINUE # 2 - EXIT if Input.trigger?(:RIGHT) @arrow_x_check = 0 @arrow_r.flash(Color.new(255,255,255), 20) CURSOR_SE.play @glowcount = 0 @menuglow.opacity = 0 @glowswitch = false case @command_window.index when 0 # NEWGAME TO CONTINUE @sprite3.bitmap = Cache.title1("Title_CommandBGBorder03") @arrow_r.x = N_R_ARROW @arrow_l.x = N_L_ARROW @arrow_r_x_base = C_R_ARROW @arrow_l_x_base = C_L_ARROW @commandanimate = 0 @commandpoint = 1 @command_window.index = 1 if @continue_enabled # CHANGE COLOR TO DISABLE IF NO SAVE EXIST @menu.tone = Tone.new(0, 0, 0, 0) @menuglow.tone = Tone.new(0, 0, 0, 0) else @menu.tone = Tone.new(0, 0, 0, 255) @menuglow.tone = Tone.new(0, 0, 0, 255) end when 1 # CONTINUE TO EXIT @sprite3.bitmap = Cache.title1("Title_CommandBGBorder02") @arrow_r.x = C_R_ARROW @arrow_l.x = C_L_ARROW @arrow_r_x_base = E_R_ARROW @arrow_l_x_base = E_L_ARROW @menu.tone = Tone.new(0, 0, 0, 0) @menuglow.tone = Tone.new(0, 0, 0,0) @commandanimate = 0 @commandpoint = 2 @command_window.index = 2 when 2 # EXIT TO NEWGAME @sprite3.bitmap = Cache.title1("Title_CommandBGBorder") @arrow_r.x = E_R_ARROW @arrow_l.x = E_L_ARROW @arrow_r_x_base = N_R_ARROW @arrow_l_x_base = N_L_ARROW @commandanimate = 0 @commandpoint = 3 @command_window.index = 0 end @arrows_x_base_switch = true end if Input.trigger?(:LEFT) @arrow_x_check = 0 @arrow_l.flash(Color.new(255,255,255), 20) CURSOR_SE.play @glowcount = 0 @menuglow.opacity = 0 @glowswitch = false case @command_window.index when 0 # NEWGAME TO EXIT @sprite3.bitmap = Cache.title1("Title_CommandBGBorder02") @arrow_r.x = N_R_ARROW @arrow_l.x = N_L_ARROW @arrow_r_x_base = E_R_ARROW @arrow_l_x_base = E_L_ARROW @commandanimate = 0 @commandpoint = 4 @command_window.index = 2 when 1 # CONTINUE TO NEWGAME @sprite3.bitmap = Cache.title1("Title_CommandBGBorder") @arrow_r.x = C_R_ARROW @arrow_l.x = C_L_ARROW @arrow_r_x_base = N_R_ARROW @arrow_l_x_base = N_L_ARROW @menu.tone = Tone.new(0, 0, 0, 0) @menuglow.tone = Tone.new(0, 0, 0,0) @commandanimate = 0 @commandpoint = 5 @command_window.index = 0 when 2 # EXIT TO CONTINUE @sprite3.bitmap = Cache.title1("Title_CommandBGBorder03") @arrow_r.x = E_R_ARROW @arrow_l.x = E_L_ARROW @arrow_r_x_base = C_R_ARROW @arrow_l_x_base = C_L_ARROW @commandanimate = 0 @commandpoint = 6 @command_window.index = 1 if @continue_enabled # CHANGE COLOR TO DISABLE IF NO SAVE EXIST @menu.tone = Tone.new(0, 0, 0, 0) @menuglow.tone = Tone.new(0, 0, 0, 0) else @menu.tone = Tone.new(0, 0, 0, 255) @menuglow.tone = Tone.new(0, 0, 0, 255) end end @arrows_x_base_switch = true end if Input.trigger?(:UP) RPG::SE.stop case @command_window.index when 0 # NEWGAME TO CONTINUE @command_window.index = 1 when 1 # CONTINUE TO EXIT @command_window.index = 2 when 2 # EXIT TO NEWGAME @command_window.index = 0 end end if Input.trigger?(:DOWN) RPG::SE.stop case @command_window.index when 0 # NEWGAME TO EXIT @command_window.index = 2 when 1 # CONTINUE TO NEWGAME @command_window.index = 0 when 2 # EXIT TO CONTINUE @command_window.index = 1 end end #COMMAND GLOW ANIMATION if @glowcount == 50 && @glowswitch == false if @menuglow.opacity != 255 @menuglow.opacity += 3 else @glowswitch = true end elsif @glowcount == 50 && @glowswitch == true if @menuglow.opacity != 0 @menuglow.opacity -= 3 else @glowswitch = false end else @glowcount += 1 end #COMMAND GLOW GRAPHIC UPDATE case @command_window.index when 0 @menuglow.bitmap = Cache.title1("Title-NewGlow") when 1 @menuglow.bitmap = Cache.title1("Title-ContinueGlow") when 2 @menuglow.bitmap = Cache.title1("Title-ExitGlow") end end #-------------------------------------------------------------------------- # Menu Command Update #-------------------------------------------------------------------------- def menu_command_update if @commandpoint == 1 # NEWGAME TO CONTINUE if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-New02") when 2 @menu.bitmap = Cache.title1("Title-New03") when 3 @menu.bitmap = Cache.title1("Title-New04") when 4 @menu.bitmap = Cache.title1("Title-New05") when 5 @menu.bitmap = Cache.title1("Title-Continue05") when 6 @menu.bitmap = Cache.title1("Title-Continue04") when 7 @menu.bitmap = Cache.title1("Title-Continue03") when 8 @menu.bitmap = Cache.title1("Title-Continue02") when 9 @menu.bitmap = Cache.title1("Title-Continue01") end end end if @commandpoint == 2 # CONTINUE TO EXIT if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-Continue02") when 2 @menu.bitmap = Cache.title1("Title-Continue03") when 3 @menu.bitmap = Cache.title1("Title-Continue04") when 4 @menu.bitmap = Cache.title1("Title-Continue05") when 5 @menu.bitmap = Cache.title1("Title-Exit05") when 6 @menu.bitmap = Cache.title1("Title-Exit04") when 7 @menu.bitmap = Cache.title1("Title-Exit03") when 8 @menu.bitmap = Cache.title1("Title-Exit02") when 9 @menu.bitmap = Cache.title1("Title-Exit01") end end end if @commandpoint == 3 # EXIT TO NEWGAME if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-Exit02") when 2 @menu.bitmap = Cache.title1("Title-Exit03") when 3 @menu.bitmap = Cache.title1("Title-Exit04") when 4 @menu.bitmap = Cache.title1("Title-Exit05") when 5 @menu.bitmap = Cache.title1("Title-New05") when 6 @menu.bitmap = Cache.title1("Title-New04") when 7 @menu.bitmap = Cache.title1("Title-New03") when 8 @menu.bitmap = Cache.title1("Title-New02") when 9 @menu.bitmap = Cache.title1("Title-New01") end end end if @commandpoint == 4 # NEWGAME TO EXIT if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-New02") when 2 @menu.bitmap = Cache.title1("Title-New03") when 3 @menu.bitmap = Cache.title1("Title-New04") when 4 @menu.bitmap = Cache.title1("Title-New05") when 5 @menu.bitmap = Cache.title1("Title-Exit05") when 6 @menu.bitmap = Cache.title1("Title-Exit04") when 7 @menu.bitmap = Cache.title1("Title-Exit03") when 8 @menu.bitmap = Cache.title1("Title-Exit02") when 9 @menu.bitmap = Cache.title1("Title-Exit01") end end end if @commandpoint == 5 # CONTINUE TO NEWGAME if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-Continue02") when 2 @menu.bitmap = Cache.title1("Title-Continue03") when 3 @menu.bitmap = Cache.title1("Title-Continue04") when 4 @menu.bitmap = Cache.title1("Title-Continue05") when 5 @menu.bitmap = Cache.title1("Title-New05") when 6 @menu.bitmap = Cache.title1("Title-New04") when 7 @menu.bitmap = Cache.title1("Title-New03") when 8 @menu.bitmap = Cache.title1("Title-New02") when 9 @menu.bitmap = Cache.title1("Title-New01") end end end if @commandpoint == 6 # EXIT TO CONTINUE if @commandanimate != 10 @commandanimate += 1 case @commandanimate when 1 @menu.bitmap = Cache.title1("Title-Exit02") when 2 @menu.bitmap = Cache.title1("Title-Exit03") when 3 @menu.bitmap = Cache.title1("Title-Exit04") when 4 @menu.bitmap = Cache.title1("Title-Exit05") when 5 @menu.bitmap = Cache.title1("Title-Continue05") when 6 @menu.bitmap = Cache.title1("Title-Continue04") when 7 @menu.bitmap = Cache.title1("Title-Continue03") when 8 @menu.bitmap = Cache.title1("Title-Continue02") when 9 @menu.bitmap = Cache.title1("Title-Continue01") end end end end #-------------------------------------------------------------------------- # * Determine if Continue is Enabled #-------------------------------------------------------------------------- def check_continue @continue_enabled = (Dir.glob('Save*.rvdata2').size > 0) end #-------------------------------------------------------------------------- # * Create Background #-------------------------------------------------------------------------- def create_background #LAYERING # 5 - Command # 4 - Sparkles Over, Menu # 3 - Logo # 2 - Command Sparkles Layer # 1 - LBGLayer,Command Sparkles # 0 - Sparkles Behind #-1 - BG @viewport1 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport2 = SPARKLE_VIEW @viewport4 = Viewport.new(0, 0, Graphics.width, Graphics.height) @viewport1.z = 4 # Sparkles Over @viewport2.z = 1 # Command Sparkles @sprite = Sprite.new @sprite.bitmap = Cache.title1("Title-BG") @sprite.z = -1 @sprite2 = Sprite.new @sprite2.bitmap = Cache.title1("Title-BGLayer") @sprite2.z = 0 # LBGLayer @sprite3 = Sprite.new if @continue_enabled @sprite3.bitmap = Cache.title1("Title_CommandBGBorder03") else @sprite3.bitmap = Cache.title1("Title_CommandBGBorder") end @sprite3.z = 2 #Command Sparkles Layer @sprite3.y = COM_BORDER @comsparkle1 = Plane.new(@viewport2) @comsparkle1.bitmap = Cache.title1("Title_CommandBG01") @comsparkle2 = Plane.new(@viewport2) @comsparkle2.bitmap = Cache.title1("Title_CommandBG02") @comsparkle3 = Plane.new(@viewport2) @comsparkle3.bitmap = Cache.title1("Title_CommandBG03") @comsparkle1.blend_type = @comsparkle2.blend_type = @comsparkle3.blend_type = 1 @sparkle1 = Plane.new(@viewport1) @sparkle1.bitmap = Cache.title1("Title-Sparkle01") @sparkle1.blend_type = 1 @sparkle1.opacity = 135 @sparkle2 = Plane.new(@viewport4) #Sparkles Behind @sparkle2.bitmap = Cache.title1("Title-Sparkle02") @sparkle2.blend_type = 1 @sparkle2.opacity = 175 @sparkle3 = Plane.new(@viewport1) @sparkle3.bitmap = Cache.title1("Title-Sparkle03") @sparkle3.blend_type = 1 @sparkle3.opacity = 215 @sparkle4 = Plane.new(@viewport1) @sparkle4.bitmap = Cache.title1("Title-Sparkle02") @sparkle4.blend_type = 1 @sparkle4.opacity = 135 #Arrow Graphic Preparation @arrow_r = Sprite.new @arrow_r.bitmap = Cache.title1("Title-ArrowR") if @continue_enabled @arrow_r.x = C_R_ARROW else @arrow_r.x = N_R_ARROW end @arrow_r.y = ARROW_Y @arrow_r.z = 5 @arrow_r_x_base = @arrow_r.x @arrow_r_x_base1 = @arrow_r_x_base + ARROW_SPEED @arrow_r_x_base2 = @arrow_r_x_base - ARROW_SPEED @arrow_l = Sprite.new @arrow_l.bitmap = Cache.title1("Title-ArrowL") if @continue_enabled @arrow_l.x = C_L_ARROW else @arrow_l.x = N_L_ARROW end @arrow_l.y = ARROW_Y @arrow_l.z = 5 @arrow_l_x_base = @arrow_l.x @arrow_l_x_base1 = @arrow_l_x_base + ARROW_SPEED @arrow_l_x_base2 = @arrow_l_x_base - ARROW_SPEED @logo = Sprite.new @logo.bitmap = Cache.title1("Logo") @logo.x = LOGO_X @logo.y = LOGO_Y @logo.z = 3 @wavelogo = Sprite.new @wavelogo.bitmap = Cache.title1("Logo") @wavelogo.wave_amp = 2 @wavelogo.wave_length = 5 @wavelogo.wave_speed = 50 @wavelogo.opacity = 155 @wavelogo.x = LOGO_X @wavelogo.y = LOGO_Y @wavelogo.z = 5 @menu = Sprite.new if @continue_enabled @menu.bitmap = Cache.title1("Title-Continue01") else @menu.bitmap = Cache.title1("Title-New01") end @menu.y = Graphics.height - 136 @menu.z = 4 @menuglow = Sprite.new if @continue_enabled @menuglow.bitmap = Cache.title1("Title-ContinueGlow") else @menuglow.bitmap = Cache.title1("Title-NewGlow") end @menuglow.opacity = 0 @menuglow.y = Graphics.height - 144 @menuglow.z = 5 @menuglow.blend_type = 1 end #-------------------------------------------------------------------------- # * Dispose Background #-------------------------------------------------------------------------- def dispose_background @sprite.bitmap.dispose @sprite.dispose @sprite2.dispose @sprite3.dispose @sparkle1.dispose @sparkle2.dispose @sparkle3.dispose @sparkle4.dispose @menuglow.dispose @comsparkle1.dispose @comsparkle2.dispose @comsparkle3.dispose @menu.dispose @logo.dispose @arrow_r.dispose @arrow_l.dispose @wavelogo.dispose end #-------------------------------------------------------------------------- # * Create Command Window #-------------------------------------------------------------------------- def create_command_window @command_window = Window_TitleCommand.new @command_window.set_handler(:new_game, method(:command_new_game)) @command_window.set_handler(:continue, method(:command_continue)) @command_window.set_handler(:shutdown, method(:command_shutdown)) @command_window.z = -2 end #-------------------------------------------------------------------------- # * Close Command Window #-------------------------------------------------------------------------- def close_command_window @command_window.close update until @command_window.close? end #-------------------------------------------------------------------------- # * [New Game] Command #-------------------------------------------------------------------------- def command_new_game DataManager.setup_new_game close_command_window fadeout_all $game_map.autoplay SceneManager.goto(Scene_Map) end #-------------------------------------------------------------------------- # * [Continue] Command #-------------------------------------------------------------------------- def command_continue if @continue_enabled close_command_window SceneManager.call(Scene_Load) end end #-------------------------------------------------------------------------- # * [Shut Down] Command #-------------------------------------------------------------------------- def command_shutdown close_command_window fadeout_all SceneManager.exit end #-------------------------------------------------------------------------- # * Play Title Screen Music #-------------------------------------------------------------------------- def play_title_music $data_system.title_bgm.play RPG::BGS.stop RPG::ME.stop end end