RPG Maker
 

 Username:
 Password:
   Not a member? Register!

Home > RGSS Script Reference > Scene_End

Scene_End


Inherits from: None

Description: This class handles the menu that appears when you select the "End Game" option from the main menu.

Code


class Scene_End
# ------------------------------------  
  def main
    s1 = "Go to Title"
    s2 = "Shutdown"
    s3 = "Cancel"
    @command_window = Window_Command.new(192, [s1, s2, s3])
    @command_window.x = 320 - @command_window.width / 2
    @command_window.y = 240 - @command_window.height / 2
    Graphics.transition
    loop do
      Graphics.update
      Input.update
      update
      if $scene != self
        break
      end
    end
    Graphics.freeze
    @command_window.dispose
    if $scene.is_a?(Scene_Title)
      Graphics.transition
      Graphics.freeze
    end
  end
# ------------------------------------  
  def update
    @command_window.update
    if Input.trigger?(Input::B)
      $game_system.se_play($data_system.cancel_se)
      $scene = Scene_Menu.new(5)
      return
    end
    if Input.trigger?(Input::C)
      case @command_window.index
      when 0
        command_to_title
      when 1
        command_shutdown
      when 2
        command_cancel
      end
      return
    end
  end
# ------------------------------------  
  def command_to_title
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = Scene_Title.new
  end
# ------------------------------------  
  def command_shutdown
    $game_system.se_play($data_system.decision_se)
    Audio.bgm_fade(800)
    Audio.bgs_fade(800)
    Audio.me_fade(800)
    $scene = nil
  end
# ------------------------------------  
  def command_cancel
    $game_system.se_play($data_system.decision_se)
    $scene = Scene_Menu.new(5)
  end
end 
 

Properties


Command_Window: A Window_Command object representing the End Game menu.

Methods


Main

Arguments: None
Local Variables: None

How it Works: This is the main method that initializes the object, processes the update, and disposes of the object. The first part of the method sets the text of the command window and sets its position. The main loop updates the graphics, checks for input, and updates the window in response to user input. Once the value of $Scene has changed (because the user has selected a command), the final part of the method disposes of the window If the new scene is the title screen, the graphics transition and freeze.

Update

Arguments: None
Local Variables: None

How it Works: This method makes the menu respond to user input. If the current input is "B" (cancel), then the cancel sound effect is played and the value of $Scene is changed to the menu screen. If the current input is "C" (decision), then the value of @command_window.index is checked to see where the cursor highlight is on the menu. If the index is 0 (Go to Title Screen), then the Command_to_Title method is called. If the index is 1 (Shutdown), then Command_Shutdown is called. If the index is 2 (Cancel), then Command_Cancel is called.

Command_to_Title

Arguments: None
Local Variables: None

How it Works: This method returns the player to the title screen. The decision sound effect is played, and the BGM, BGS, and ME are faded out with a fade duration of 800 ms. The $Scene is then changed to the title screen.

Command_Shutdown

Arguments: None
Local Variables: None

How it Works: This method returns the player to the title screen. The decision sound effect is played, and the BGM, BGS, and ME are faded out with a fade duration of 800 ms. The $Scene is then changed to nil, when causes Game.exe to exit.

Command_Cancel

Arguments: None
Local Variables: None

How it Works: This method cancels the menu and returns the user to the main menu. The decision sound effect is played, and $Scene is changed back to the main menu. 
Syntax
@
@@
$
alias
[array index]
attr_accessor
attr_reader
attr_writer
class
def
do
ensure
for
if
[iterator]
key => value
new
next
nil
redo
require
return
rescue
self
super
undef
unless
until
while
yield

Classes
Arrow_Actor
Arrow_Base
Arrow_Enemy
Game_Actor
Game_Actors
Game_BattleAct
Game_Battler
Game_Character
Game_Common
Game_Enemy
Game_Event
Game_Map
Game_Party
Game_Picture
Game_Player
Game_Screen
Game_SlfSwitch
Game_Switches
Game_System
Game_Troop
Game_Variables
Interpreter
Scene_Debug
Scene_End
Scene_Equip
Scene_File
Scene_Gameover
Scene_Item
Scene_Load
Scene_Map
Scene_Menu
Scene_Name
Scene_Save
Scene_Shop
Scene_Skill
Scene_Status
Scene_Title
Sprite_Battler
Sprite_Character
Sprite_Picture
Sprite_Timer
Spriteset_Battle
Spriteset_Map
Window_Base
Window_Battleresult
Window_Battlestatus
Window_Command
Window_DebugLeft
Window_DebugRight
Window_EquipItem
Window_EquipLeft
Window_EquipRight
Window_Gold
Window_Help
Window_InputNumb
Window_Item
Window_MenuStatus
Window_Message
Window_NameEdit
Window_NameInput
Window_PartyCom
Window_PlayTime
Window_SaveFile
Window_Selectable
Window_ShopBuy
Window_ShopCom
Window_ShopNum
Window_ShopSell
Window_ShopStatus
Window_Skill
Window_SkillStatus
Window_Status
Window_Steps
Window_Target

Other
Class Hierarchy
Global Variables


RPG RPG Revolution
RPG RPG Revolution is your #1 stop for game development and console RPG games, as well as those created by people like you. Link to us to support us, so we may grow to be better website community for you.

By continuing past this page, and by your continued use of this site, you agree to be bound by and abide by the Terms of Use.
©2004 - 2008 RPG RPG Revolution, All Rights Reserved. Contact Us · Privacy Policy · Legal Disclaimer
eXTReMe Tracker