Advertisement
Guest User

Scene_Map 1

a guest
Apr 3rd, 2020
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 7.88 KB | None | 0 0
  1. #==============================================================================
  2.  
  3. # * Scene_Map
  4.  
  5. #------------------------------------------------------------------------------
  6.  
  7. #  It is the class which processes the map picture.
  8.  
  9. #==============================================================================
  10.  
  11. class Scene_Map
  12.  
  13.   #--------------------------------------------------------------------------
  14.  
  15.   # - Main processing
  16.  
  17.   #--------------------------------------------------------------------------
  18.  
  19.   def main
  20.  
  21.     # Drawing up sprite set
  22.  
  23.     @spriteset = Spriteset_Map.new
  24.  
  25.     # Drawing up the message window
  26.  
  27.     @message_window = Window_Message.new
  28.  
  29.     # Draw HP Window
  30.  
  31.     draw_hp
  32.  
  33.     hide_hud
  34.  
  35.     # Transition execution
  36.  
  37.     Graphics.transition
  38.  
  39.     # Main loop
  40.  
  41.     loop do
  42.  
  43.       # Renewing the game picture
  44.  
  45.       Graphics.update
  46.  
  47.       # Updating the information of input
  48.  
  49.       Input.update
  50.  
  51.       @hp_slide.ox += 1
  52.  
  53.       # Frame renewal
  54.  
  55.       update
  56.  
  57.       # When the picture changes, discontinuing the loop
  58.  
  59.       if $scene != self
  60.  
  61.         break
  62.  
  63.       end
  64.  
  65.     end
  66.  
  67.     # Transition preparation
  68.  
  69.     Graphics.freeze
  70.  
  71.     # Releasing sprite set
  72.  
  73.     @spriteset.dispose
  74.  
  75.     # Releasing the message window
  76.  
  77.     @message_window.dispose
  78.  
  79.     dispose_hp
  80.  
  81.     # When it changes to the title picture and it is in
  82.  
  83.     if $scene.is_a?(Scene_Title)
  84.  
  85.       # Fading out picture
  86.  
  87.       Graphics.transition
  88.  
  89.       Graphics.freeze
  90.  
  91.     end
  92.  
  93.   end
  94.  
  95.   #--------------------------------------------------------------------------
  96.  
  97.   # - Frame renewal
  98.  
  99.   #--------------------------------------------------------------------------
  100.  
  101.   def update
  102.  
  103.     # oop
  104.  
  105.     loop do
  106.  
  107.       # The map, it renews to the order of the interpreter and the prayer
  108.  
  109.       # (As for this renewal order, when the condition for executing the event is satisfied
  110.  
  111.       #  In the reason such that the opportunity which instant is moved in the prayer is not given the importance)
  112.  
  113.       $game_map.update
  114.  
  115.       $game_system.map_interpreter.update
  116.  
  117.       $game_player.update
  118.  
  119.       # e system (the timer), renewing the picture
  120.  
  121.       $game_system.update
  122.  
  123.       $game_screen.update
  124.  
  125.       # If it is not the place on the move of the prayer, discontinuing the loop
  126.  
  127.       unless $game_temp.player_transferring
  128.  
  129.         break
  130.  
  131.       end
  132.  
  133.       # Executing place movement
  134.  
  135.       transfer_player
  136.  
  137.       # When it is in the midst of transition processing, discontinuing the loop
  138.  
  139.       if $game_temp.transition_processing
  140.  
  141.         break
  142.  
  143.       end
  144.  
  145.     end
  146.  
  147.     hide_hud
  148.  
  149.     # Renewing sprite set
  150.  
  151.     @spriteset.update
  152.  
  153.     # Renewing the message window
  154.  
  155.     @message_window.update
  156.  
  157.     @hp_window.update
  158.  
  159.     @viewport_bor.update
  160.  
  161.     @hp_bor.update
  162.  
  163.     # When it is the game over
  164.  
  165.     if $game_temp.gameover
  166.  
  167.       # Change to game over picture
  168.  
  169.       $scene = Scene_Gameover.new
  170.  
  171.       return
  172.  
  173.     end
  174.  
  175.     # When you reset to the title picture
  176.  
  177.     if $game_temp.to_title
  178.  
  179.       # Change to title picture
  180.  
  181.       $scene = Scene_Title.new
  182.  
  183.       return
  184.  
  185.     end
  186.  
  187.     # When it is in the midst of transition processing
  188.  
  189.     if $game_temp.transition_processing
  190.  
  191.       # During transition processing clearing the flag
  192.  
  193.       $game_temp.transition_processing = false
  194.  
  195.       # Transition execution
  196.  
  197.       if $game_temp.transition_name == ""
  198.  
  199.         Graphics.transition(20)
  200.  
  201.       else
  202.  
  203.         Graphics.transition(40, "Graphics/Transitions/" +
  204.  
  205.           $game_temp.transition_name)
  206.  
  207.       end
  208.  
  209.     end
  210.  
  211.     # When it is in the midst of message window indicating
  212.  
  213.     if $game_temp.message_window_showing
  214.  
  215.       return
  216.  
  217.     end
  218.  
  219.     # When encounter count with 0, Encounter is not the sky
  220.  
  221.     if $game_player.encounter_count == 0 and $game_map.encounter_list != []
  222.  
  223.       # If it is not in the midst of event executing or in the midst of encounter prohibiting
  224.  
  225.       unless $game_system.map_interpreter.running? or
  226.  
  227.              $game_system.encounter_disabled
  228.  
  229.         # Deciding the troop
  230.  
  231.         n = rand($game_map.encounter_list.size)
  232.  
  233.         troop_id = $game_map.encounter_list[n]
  234.  
  235.         # If troop validity
  236.  
  237.         if $data_troops[troop_id] != nil
  238.  
  239.           # Setting the battle call flag
  240.  
  241.           $game_temp.battle_calling = true
  242.  
  243.           $game_temp.battle_troop_id = troop_id
  244.  
  245.           $game_temp.battle_can_escape = true
  246.  
  247.           $game_temp.battle_can_lose = false
  248.  
  249.           $game_temp.battle_proc = nil
  250.  
  251.         end
  252.  
  253.       end
  254.  
  255.     end
  256.  
  257.     # The B when button is pushed
  258.  
  259.     if Input.trigger?(Input::B)
  260.  
  261.       # If it is not in the midst of event executing or in the midst of menu prohibiting
  262.  
  263.       unless $game_system.map_interpreter.running? or
  264.  
  265.              $game_system.menu_disabled
  266.  
  267.         # Setting the menu call flag and the SE performance flag
  268.  
  269.         $game_temp.menu_calling = true
  270.  
  271.         $game_temp.menu_beep = true
  272.  
  273.       end
  274.  
  275.     end
  276.  
  277.     # When debugging mode ON and the F8 key are pushed
  278.  
  279.     if $DEBUG and Input.press?(Input::F8)
  280.  
  281.       # Performing decision SE
  282.  
  283.       $game_system.se_play($data_system.decision_se)
  284.  
  285.       # Reforming the attitude of the prayer
  286.  
  287.       $game_player.straighten
  288.  
  289.       # Change to saving picture
  290.  
  291.       $scene = Scene_Save.new
  292.  
  293.     end
  294.  
  295.     # When debugging mode ON and the F9 key are pushed
  296.  
  297.     if $DEBUG and Input.press?(Input::F9)
  298.  
  299.       # Setting the debugging call flag
  300.  
  301.       $game_temp.debug_calling = true
  302.  
  303.     end
  304.  
  305.     # When it is not on the move of the prayer
  306.  
  307.     unless $game_player.moving?
  308.  
  309.       # Executing the call of various pictures
  310.  
  311.       if $game_temp.battle_calling
  312.  
  313.         call_battle
  314.  
  315.       elsif $game_temp.shop_calling
  316.  
  317.         call_shop
  318.  
  319.       elsif $game_temp.name_calling
  320.  
  321.         call_name
  322.  
  323.       elsif $game_temp.menu_calling
  324.  
  325.         call_menu
  326.  
  327.       elsif $game_temp.save_calling
  328.  
  329.         call_save
  330.  
  331.       elsif $game_temp.debug_calling
  332.  
  333.         call_debug
  334.  
  335.       elsif $game_temp.shoot
  336.  
  337.         @spriteset.shoot
  338.  
  339.         $game_temp.shoot = false
  340.  
  341.       elsif $game_temp.hit
  342.  
  343.         $game_temp.hit = false
  344.  
  345.       end
  346.  
  347.     end
  348.  
  349.   end
  350.  
  351.     #--------------------------------------------------------------------------
  352.  
  353.   # - Place movement of prayer
  354.  
  355.   #--------------------------------------------------------------------------
  356.  
  357.   def transfer_player
  358.  
  359.     # Clearing the prayer place portable flag
  360.  
  361.     $game_temp.die_point = true
  362.  
  363.     $game_temp.player_transferring = false
  364.  
  365.     # When the tip of moving differs from the present map
  366.  
  367.     if $game_map.map_id != $game_temp.player_new_map_id
  368.  
  369.       #Setting up the new map
  370.  
  371.       $game_map.setup($game_temp.player_new_map_id)
  372.  
  373.     end
  374.  
  375.     $game_temp.die_point = false
  376.  
  377.     # Setting the position of the prayer
  378.  
  379.     $game_player.moveto($game_temp.player_new_x, $game_temp.player_new_y)
  380.  
  381.     case $game_temp.player_new_direction
  382.  
  383.     when 2  # Down
  384.  
  385.       $game_player.turn_down
  386.  
  387.     when 4  # Left
  388.  
  389.       $game_player.turn_left
  390.  
  391.     when 6  # Right
  392.  
  393.       $game_player.turn_right
  394.  
  395.     when 8  # Up
  396.  
  397.       $game_player.turn_up
  398.  
  399.     end
  400.  
  401.     # Map renewal (parallel event execution)
  402.  
  403.     $game_map.update
  404.  
  405.     # Rewriting sprite set
  406.  
  407.     @spriteset.dispose
  408.  
  409.     @spriteset = Spriteset_Map.new
  410.  
  411.     # When it is in the midst of transition processing
  412.  
  413.     if $game_temp.transition_processing
  414.  
  415.       # During transition processing clearing the flag
  416.  
  417.       $game_temp.transition_processing = false
  418.  
  419.       # Transition execution
  420.  
  421.       Graphics.transition(20)
  422.  
  423.     end
  424.  
  425.     # Executing the automatic operation change of BGM and BGS which are set to the map
  426.  
  427.     $game_map.autoplay
  428.  
  429.     # Frame reset
  430.  
  431.     Graphics.frame_reset
  432.  
  433.     # Updating the information of input
  434.  
  435.     Input.update
  436.  
  437.   end
  438.  
  439. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement