DizzyFoxkit

Scene_End Attraction

May 24th, 2012
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.12 KB | None | 0 0
  1. class Scene_End
  2.   #--------------------------------------------------------------------------
  3.   # * Main Processing
  4.   #--------------------------------------------------------------------------
  5.   def main
  6.     # Make command window
  7.     s1 = "To Front Page"
  8.     s2 = "Exit Story"
  9.     s3 = "Cancel"
  10.     @command_window = Window_Command.new(192, [s1, s2, s3])
  11.     @command_window.x = 320 - @command_window.width / 2
  12.     @command_window.y = 240 - @command_window.height / 2
  13.     # Execute transition
  14.     Graphics.transition
  15.     # Main loop
  16.     loop do
  17.       # Update game screen
  18.       Graphics.update
  19.       # Update input information
  20.       Input.update
  21.       # Frame Update
  22.       update
  23.       # Abort loop if screen is changed
  24.       if $scene != self
  25.         break
  26.       end
  27.     end
  28.     # Prepare for transition
  29.     Graphics.freeze
  30.     # Dispose of window
  31.     @command_window.dispose
  32.     # If switching to title screen
  33.     if $scene.is_a?(Scene_Title)
  34.       # Fade out screen
  35.       Graphics.transition
  36.       Graphics.freeze
  37.     end
  38.   end
  39.   #--------------------------------------------------------------------------
  40.   # * Frame Update
  41.   #--------------------------------------------------------------------------
  42.   def update
  43.     # Update command window
  44.     @command_window.update
  45.     # If B button was pressed
  46.     if Input.trigger?(Input::B)
  47.       # Play cancel SE
  48.       $game_system.se_play($data_system.cancel_se)
  49.       # Switch to menu screen
  50.       $scene = Scene_Menu.new(7)
  51.       return
  52.     end
  53.     # If C button was pressed
  54.     if Input.trigger?(Input::C)
  55.       # Branch by command window cursor position
  56.       case @command_window.index
  57.       when 0  # to title
  58.         command_to_title
  59.       when 1  # shutdown
  60.         command_shutdown
  61.       when 2  # quit
  62.         command_cancel
  63.       end
  64.       return
  65.     end
  66.   end
  67.   #--------------------------------------------------------------------------
  68.   # * Process When Choosing [To Title] Command
  69.   #--------------------------------------------------------------------------
  70.   def command_to_title
  71.     # Play decision SE
  72.     $game_system.se_play($data_system.decision_se)
  73.     # Fade out BGM, BGS, and ME
  74.     Audio.bgm_fade(800)
  75.     Audio.bgs_fade(800)
  76.     Audio.me_fade(800)
  77.     # Switch to title screen
  78.     $scene = Scene_Title.new
  79.   end
  80.   #--------------------------------------------------------------------------
  81.   # * Process When Choosing [Shutdown] Command
  82.   #--------------------------------------------------------------------------
  83.   def command_shutdown
  84.     # Play decision SE
  85.     $game_system.se_play($data_system.decision_se)
  86.     # Fade out BGM, BGS, and ME
  87.     Audio.bgm_fade(800)
  88.     Audio.bgs_fade(800)
  89.     Audio.me_fade(800)
  90.     # Shutdown
  91.     $scene = nil
  92.   end
  93.   #--------------------------------------------------------------------------
  94.   # *  Process When Choosing [Cancel] Command
  95.   #--------------------------------------------------------------------------
  96.   def command_cancel
  97.     # Play decision SE
  98.     $game_system.se_play($data_system.decision_se)
  99.     # Switch to menu screen
  100.     $scene = Scene_Menu.new(5)
  101.   end
  102. end
Advertisement
Add Comment
Please, Sign In to add comment