Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Scene_Title
- #------------------------------------------------------------------------------
- # This class performs the title screen processing.
- #==============================================================================
- class Scene_Title2 < Scene_Base
- #--------------------------------------------------------------------------
- # * Start Processing
- #--------------------------------------------------------------------------
- def start
- super
- SceneManager.clear
- Graphics.freeze
- create_background
- create_foreground
- 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
- dispose_foreground
- end
- #--------------------------------------------------------------------------
- # * Create Background
- #--------------------------------------------------------------------------
- def create_background
- @sprite1 = Plane.new
- @sprite1.bitmap = Cache.parallax("SeaOfClouds")
- @sprite2 = Plane.new
- @sprite2.bitmap = Cache.parallax("SeaOfClouds")
- @menu=Sprite.new
- @main_title=Sprite.new @main_title.bitmap=Cache.system("title")
- #center_sprite(@sprite1)
- #center_sprite(@sprite2)
- @sprite1.z=-1
- @sprite1.opacity=150
- @sprite1.blend_type=0
- end
- def update
- super
- @sprite2.ox+=1
- @sprite1.ox=@sprite2.ox/2
- case @command_window.index
- when 0 #new game
- @menu.bitmap = Cache.picture("NewGameSelected")
- when 1 #continue
- @menu.bitmap = Cache.picture("ContinueGameSelected")
- when 2 #quit
- @menu.bitmap = Cache.picture("ExitGameSelected")
- end
- end
- #--------------------------------------------------------------------------
- # * Create Foreground
- #--------------------------------------------------------------------------
- def create_foreground
- @foreground_sprite = Sprite.new
- @foreground_sprite.bitmap = Bitmap.new(Graphics.width, Graphics.height)
- @foreground_sprite.z = 100
- draw_game_title if $data_system.opt_draw_title
- end
- #--------------------------------------------------------------------------
- # * Draw Game Title
- #--------------------------------------------------------------------------
- def draw_game_title
- @foreground_sprite.bitmap.font.size = 48
- rect = Rect.new(0, 0, Graphics.width, Graphics.height / 2)
- @foreground_sprite.bitmap.draw_text(rect, $data_system.game_title, 1)
- end
- #--------------------------------------------------------------------------
- # * Free Background
- #--------------------------------------------------------------------------
- def dispose_background
- @sprite1.bitmap.dispose
- @sprite1.dispose
- @sprite2.bitmap.dispose
- @sprite2.dispose
- end
- #--------------------------------------------------------------------------
- # * Free Foreground
- #--------------------------------------------------------------------------
- def dispose_foreground
- @foreground_sprite.bitmap.dispose
- @foreground_sprite.dispose
- end
- #--------------------------------------------------------------------------
- # * Move Sprite to Screen Center
- #--------------------------------------------------------------------------
- def center_sprite(sprite)
- sprite.ox = sprite.bitmap.width / 2
- sprite.oy = sprite.bitmap.height / 2
- sprite.x = Graphics.width / 2
- sprite.y = Graphics.height / 2
- 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.x=9999
- 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
- close_command_window
- SceneManager.call(Scene_Load)
- 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement