IceDragon200

Xail-CharacterScene

May 1st, 2011
196
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.86 KB | None | 0 0
  1. #==============================================================================
  2. #   XaiL's Character Scene
  3. #   Author: XaiL
  4. #   04/02/2011
  5. #==============================================================================
  6. $imported = {} if $imported == nil
  7. $imported["Xail-CharacterScene"] = true
  8. #==============================================================================#
  9. # Xail
  10. #==============================================================================#
  11. module Xail
  12.   #--------------------------------------------------------------------------#
  13.   # * Settings
  14.   #--------------------------------------------------------------------------#
  15.   FADE_IN_TIME = 30    # Fade in time when Scene is loaded.
  16.   CLASSES = ["Magician", "Ranger", "Guardian"]
  17.   CHARACTER_Y = 178    # Y position for window.
  18.   SELECTION_X = 10     # X position for select character image.
  19.   SELECTION_Y = 30     # Y position for select character image.
  20. end
  21.   #Don't edit below!
  22. #==============================================================================  
  23. =begin
  24. Edited by IceDragon (cause I can)
  25. As a kinda standard
  26.  
  27. initialize
  28. start
  29. terminate
  30. return_scene (or change scenes)
  31. commands
  32. create
  33. dispose
  34. update
  35. =end
  36. #==============================================================================#
  37. # Scene_CharacterSelection
  38. #==============================================================================#
  39. class Scene_CharacterSelection < Scene_Base
  40.  
  41.   @@available_classes = Xail::CLASSES
  42.   @@fade_in_time      = Xail::FADE_IN_TIME
  43.  
  44.   def start
  45.     super
  46.     create_menu_background
  47.     create_command_window
  48.     create_graphic
  49.   end
  50.  
  51.   def terminate
  52.     super
  53.     dispose_command_window
  54.     dispose_graphic
  55.   end
  56.  
  57.   def call_difficulty_screen
  58.     $scene = Scene_Difficult.new
  59.   end
  60.  
  61.   def return_scene
  62.     $scene = Scene_Title.new
  63.   end
  64.  
  65.   def command_class( index )
  66.     $game_party.remove_actor(1)
  67.     $game_party.remove_actor(2)
  68.     $game_party.remove_actor(3)
  69.     # // This
  70.     case index
  71.     when 0 ; $game_party.add_actor(1)
  72.     when 1 ; $game_party.add_actor(2)
  73.     when 2 ; $game_party.add_actor(3)
  74.     end  
  75.     # // Or this...
  76.     # $game_party.add_actor( index+1 )
  77.     $game_player.refresh
  78.     call_difficulty_screen
  79.   end
  80.  
  81.   def create_graphic
  82.     @selection = Sprite_Base.new
  83.     @selection.bitmap = Cache.system("select_character")
  84.     @selection.x = Xail::SELECTION_X
  85.     @selection.y = Xail::SELECTION_Y
  86.     #@back_sprite = Sprite_Base.new
  87.     #@back_sprite.bitmap = $game_temp.background_bitmap
  88.   end
  89.  
  90.   def create_command_window
  91.     a = @@available_classes.clone
  92.     a << "Back"
  93.     @command_window = Window_Command.new(272, a)
  94.     @command_window.x = (Graphics.width - @command_window.width) / 2
  95.     @command_window.y = Xail::CHARACTER_Y
  96.     @command_window.open
  97.   end
  98.  
  99.   def dispose_command_window
  100.     @command_window.dispose
  101.   end
  102.  
  103.   def dispose_graphic
  104.     @back_sprite.dispose
  105.     @selection.dispose
  106.   end
  107.  
  108.   def update
  109.     super
  110.     @command_window.update
  111.     if Input.trigger?(Input::C)
  112.       case @command_window.index
  113.       when 0..2    # Class1
  114.         Sound.play_decision
  115.         command_class( @command_window.index )
  116.       when 3    # Cancel
  117.         Sound.play_decision
  118.         return_scene
  119.       end
  120.     elsif Input.trigger?(Input::B)
  121.       Sound.play_cancel
  122.       return_scene
  123.     end
  124.   end
  125.  
  126.   def perform_transition
  127.     Graphics.transition(@@fade_in_time)
  128.   end
  129.  
  130. end # END OF FILE
  131.  
  132. #==============================================================================#
  133. # Scene_Character
  134. #==============================================================================#
  135. Scene_Character = Scene_CharacterSelection
  136.  
  137. #=*==========================================================================*=#
  138. # ** END OF FILE
  139. #=*==========================================================================*=#
Advertisement
Add Comment
Please, Sign In to add comment