Advertisement
Demonicskyers

Obrazki zamiast title

Oct 31st, 2013
856
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 8.99 KB | None | 0 0
  1. #=====================================================
  2. # ** Scene_Title
  3. #------------------------------------------------------------------------------
  4. #  This class performs title screen processing.
  5. #=========================================================
  6.  
  7. class Scene_Title
  8.   #--------------------------------------------------------------------------
  9.   # * Main Processing
  10.   #--------------------------------------------------------------------------
  11.   def main
  12.     # If battle test
  13.     if $BTEST
  14.       battle_test
  15.       return
  16.     end
  17.     # Load database
  18.     $data_actors        = load_data("Data/Actors.rxdata")
  19.     $data_classes       = load_data("Data/Classes.rxdata")
  20.     $data_skills        = load_data("Data/Skills.rxdata")
  21.     $data_items         = load_data("Data/Items.rxdata")
  22.     $data_weapons       = load_data("Data/Weapons.rxdata")
  23.     $data_armors        = load_data("Data/Armors.rxdata")
  24.     $data_enemies       = load_data("Data/Enemies.rxdata")
  25.     $data_troops        = load_data("Data/Troops.rxdata")
  26.     $data_states        = load_data("Data/States.rxdata")
  27.     $data_animations    = load_data("Data/Animations.rxdata")
  28.     $data_tilesets      = load_data("Data/Tilesets.rxdata")
  29.     $data_common_events = load_data("Data/CommonEvents.rxdata")
  30.     $data_system        = load_data("Data/System.rxdata")
  31.     # Make system object
  32.     $game_system = Game_System.new
  33.     # Make title graphic
  34.     @sprite = Sprite.new
  35.    
  36.     # NEW CODE
  37.     @back_sprite = Sprite.new
  38.     @back_sprite.z = @sprite.z - 10
  39.    
  40.     # transition between images, set to 0 if none
  41.     @transition_frames = 10
  42.     @delta = 255 / @transition_frames
  43.     @wait = 0
  44.     #END NEW CODE
  45.    
  46.     # Continue enabled determinant
  47.     # Check if at least one save file exists
  48.     # If enabled, make @continue_enabled true; if disabled, make it false
  49.     @continue_enabled = false
  50.     for i in 0..3
  51.       if FileTest.exist?("Save#{i+1}.rxdata")
  52.         @continue_enabled = true
  53.       end
  54.     end
  55.    
  56.     # If continue is enabled, move cursor to "Continue"
  57.     # NEW CODE
  58.     if @continue_enabled
  59.       @sprite.bitmap = RPG::Cache.title("2")
  60.       @back_sprite.bitmap = RPG::Cache.title("2")
  61.       @index = 2
  62.     else
  63.       @sprite.bitmap = RPG::Cache.title("1")
  64.       @back_sprite.bitmap = RPG::Cache.title("1")
  65.       @index = 1
  66.     end
  67.     # END NEW CODE
  68.    
  69.     # Play title BGM
  70.     $game_system.bgm_play($data_system.title_bgm)
  71.     # Stop playing ME and BGS
  72.     Audio.me_stop
  73.     Audio.bgs_stop
  74.     # Execute transition
  75.     Graphics.transition
  76.     # Main loop
  77.     loop do
  78.       # Update game screen
  79.       Graphics.update
  80.       # Update input information
  81.       Input.update
  82.       # Frame update
  83.       update
  84.       # Abort loop if screen is changed
  85.       if $scene != self
  86.         break
  87.       end
  88.     end
  89.     # Prepare for transition
  90.     Graphics.freeze
  91.  
  92.     # Dispose of title graphic
  93.     @sprite.bitmap.dispose
  94.     @sprite.dispose
  95.   end
  96.   #--------------------------------------------------------------------------
  97.   # * Frame Update
  98.   #--------------------------------------------------------------------------
  99.   def update
  100.     # NEW CODE
  101.     if @wait >= 0
  102.       if @wait == 0
  103.         @sprite.bitmap = RPG::Cache.title(@index.to_s)
  104.         @sprite.opacity = 255
  105.       else
  106.         @sprite.opacity -= @delta
  107.       end
  108.       @wait -= 1
  109.       return
  110.     end
  111.     # if directional buttons are pressed
  112.     if Input.trigger?(Input::LEFT) or Input.trigger?(Input::UP)
  113.       $game_system.se_play($data_system.cursor_se)
  114.       if @index == 1
  115.         @index = 3
  116.       else
  117.         @index -= 1
  118.       end
  119.       @wait = @transition_frames
  120.       @back_sprite.bitmap = RPG::Cache.title(@index.to_s)
  121.     end
  122.     if Input.trigger?(Input::RIGHT) or Input.trigger?(Input::DOWN)
  123.       $game_system.se_play($data_system.cursor_se)
  124.       if @index == 3
  125.         @index = 1
  126.       else
  127.         @index += 1
  128.       end
  129.       @wait = @transition_frames
  130.       @back_sprite.bitmap = RPG::Cache.title(@index.to_s)
  131.     end
  132.     # If C button was pressed
  133.     if Input.trigger?(Input::C)
  134.       # Branch by index
  135.       case @index
  136.       when 1  # New game
  137.         command_new_game
  138.       when 2  # Continue
  139.         command_continue
  140.       when 3  # Shutdown
  141.         command_shutdown
  142.       end
  143.     end
  144.     # END NEW CODE
  145.   end
  146.   #--------------------------------------------------------------------------
  147.   # * Command: New Game
  148.   #--------------------------------------------------------------------------
  149.   def command_new_game
  150.     # Play decision SE
  151.     $game_system.se_play($data_system.decision_se)
  152.     # Stop BGM
  153.     Audio.bgm_stop
  154.     # Reset frame count for measuring play time
  155.     Graphics.frame_count = 0
  156.     # Make each type of game object
  157.     $game_temp          = Game_Temp.new
  158.     $game_system        = Game_System.new
  159.     $game_switches      = Game_Switches.new
  160.     $game_variables     = Game_Variables.new
  161.     $game_self_switches = Game_SelfSwitches.new
  162.     $game_screen        = Game_Screen.new
  163.     $game_actors        = Game_Actors.new
  164.     $game_party         = Game_Party.new
  165.     $game_troop         = Game_Troop.new
  166.     $game_map           = Game_Map.new
  167.     $game_player        = Game_Player.new
  168.     # Set up initial party
  169.     $game_party.setup_starting_members
  170.     # Set up initial map position
  171.     $game_map.setup($data_system.start_map_id)
  172.     # Move player to initial position
  173.     $game_player.moveto($data_system.start_x, $data_system.start_y)
  174.     # Refresh player
  175.     $game_player.refresh
  176.     # Run automatic change for BGM and BGS set with map
  177.     $game_map.autoplay
  178.     # Update map (run parallel process event)
  179.     $game_map.update
  180.     # Switch to map screen
  181.     $scene = Scene_Map.new
  182.   end
  183.   #--------------------------------------------------------------------------
  184.   # * Command: Continue
  185.   #--------------------------------------------------------------------------
  186.   def command_continue
  187.     # If continue is disabled
  188.     unless @continue_enabled
  189.       # Play buzzer SE
  190.       $game_system.se_play($data_system.buzzer_se)
  191.       return
  192.     end
  193.     # Play decision SE
  194.     $game_system.se_play($data_system.decision_se)
  195.     # Switch to load screen
  196.     $scene = Scene_Load.new
  197.   end
  198.   #--------------------------------------------------------------------------
  199.   # * Command: Shutdown
  200.   #--------------------------------------------------------------------------
  201.   def command_shutdown
  202.     # Play decision SE
  203.     $game_system.se_play($data_system.decision_se)
  204.     # Fade out BGM, BGS, and ME
  205.     Audio.bgm_fade(800)
  206.     Audio.bgs_fade(800)
  207.     Audio.me_fade(800)
  208.     # Shutdown
  209.     $scene = nil
  210.   end
  211.   #--------------------------------------------------------------------------
  212.   # * Battle Test
  213.   #--------------------------------------------------------------------------
  214.   def battle_test
  215.     # Load database (for battle test)
  216.     $data_actors        = load_data("Data/BT_Actors.rxdata")
  217.     $data_classes       = load_data("Data/BT_Classes.rxdata")
  218.     $data_skills        = load_data("Data/BT_Skills.rxdata")
  219.     $data_items         = load_data("Data/BT_Items.rxdata")
  220.     $data_weapons       = load_data("Data/BT_Weapons.rxdata")
  221.     $data_armors        = load_data("Data/BT_Armors.rxdata")
  222.     $data_enemies       = load_data("Data/BT_Enemies.rxdata")
  223.     $data_troops        = load_data("Data/BT_Troops.rxdata")
  224.     $data_states        = load_data("Data/BT_States.rxdata")
  225.     $data_animations    = load_data("Data/BT_Animations.rxdata")
  226.     $data_tilesets      = load_data("Data/BT_Tilesets.rxdata")
  227.     $data_common_events = load_data("Data/BT_CommonEvents.rxdata")
  228.     $data_system        = load_data("Data/BT_System.rxdata")
  229.     # Reset frame count for measuring play time
  230.     Graphics.frame_count = 0
  231.     # Make each game object
  232.     $game_temp          = Game_Temp.new
  233.     $game_system        = Game_System.new
  234.     $game_switches      = Game_Switches.new
  235.     $game_variables     = Game_Variables.new
  236.     $game_self_switches = Game_SelfSwitches.new
  237.     $game_screen        = Game_Screen.new
  238.     $game_actors        = Game_Actors.new
  239.     $game_party         = Game_Party.new
  240.     $game_troop         = Game_Troop.new
  241.     $game_map           = Game_Map.new
  242.     $game_player        = Game_Player.new
  243.     # Set up party for battle test
  244.     $game_party.setup_battle_test_members
  245.     # Set troop ID, can escape flag, and battleback
  246.     $game_temp.battle_troop_id = $data_system.test_troop_id
  247.     $game_temp.battle_can_escape = true
  248.     $game_map.battleback_name = $data_system.battleback_name
  249.     # Play battle start SE
  250.     $game_system.se_play($data_system.battle_start_se)
  251.     # Play battle BGM
  252.     $game_system.bgm_play($game_system.battle_bgm)
  253.     # Switch to battle screen
  254.     $scene = Scene_Battle.new
  255.   end
  256. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement