DaxSoft

freeMessage

Apr 8th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 3.00 KB | None | 0 0
  1.  
  2. # DEFINA O ID DA SWITCH, QUE, QUANDO LIGADA, IRÁ
  3. # FAZER O PLAYER IMPOSSÍVEL DE SE MOVER, ENQUANTO ESTIVER ROLANDO
  4. # UMA MENSAGEM
  5.  
  6. Vorum::SMF_MES = 1
  7.  
  8.  
  9. class Game_Player < Game_Character
  10.   def update
  11.     # Memorizar, se estiver movendo ou não, nas variáveis locais
  12.     last_moving = moving?
  13.     # Se estiver movendo, um evento ocorrendo, uma rota pré-determinada, ou
  14.     # se estiver exibindo uma mensagem
  15.     # Mostrar tudo como se não estivessem ocorrendo
  16.     if ($game_temp.message_window_showing == true)
  17.       windowShowing = ($game_switches[Vorum::SMF_MES])
  18.     else
  19.       windowShowing = false
  20.     end
  21.     #$game_system.map_interpreter.running?
  22.     #
  23.     unless moving? or
  24.            @move_route_forcing or windowShowing
  25.       # Mover o Jogador na direção que o direcional for pressionado
  26.       case Input.dir4
  27.       when 2
  28.         move_down
  29.       when 4
  30.         move_left
  31.       when 6
  32.         move_right
  33.       when 8
  34.         move_up
  35.       end
  36.     end
  37.     # Memorizar as coordenadas nas variáveis locais
  38.     last_real_x = @real_x
  39.     last_real_y = @real_y
  40.     super
  41.     # Se o Herói for movido para baixo e tenha ficado abaixo do centro da tela
  42.     if @real_y > last_real_y and @real_y - $game_map.display_y > CENTER_Y
  43.       # Rolar o mapa para baixo
  44.       $game_map.scroll_down(@real_y - last_real_y)
  45.     end
  46.     # Se o Herói for movido para a esquerda e tenha ficado a esquerda do centro
  47.     # da tela
  48.     if @real_x < last_real_x and @real_x - $game_map.display_x < CENTER_X
  49.       # Rolar o mapa para a esquerda
  50.       $game_map.scroll_left(last_real_x - @real_x)
  51.     end
  52.     # Se o Herói for movido para a direita e tenha ficado a direita do centro da
  53.     # tela
  54.     if @real_x > last_real_x and @real_x - $game_map.display_x > CENTER_X
  55.       # Rolar o mapa para a direita
  56.       $game_map.scroll_right(@real_x - last_real_x)
  57.     end
  58.     # Se o Herói for movido para cima e tenha ficado acima do centro da tela
  59.     if @real_y < last_real_y and @real_y - $game_map.display_y < CENTER_Y
  60.       # rolar o mapa para cima
  61.       $game_map.scroll_up(last_real_y - @real_y)
  62.     end
  63.     # Se não estiver movendo
  64.     unless moving?
  65.       # Se o jogador estava se movendo
  66.       if last_moving
  67.         # Se a determinante de incialização for por toque ou mesma posição
  68.         result = check_event_trigger_here([1,2])
  69.         # Se o Evento que foi iniciado não existir
  70.         if result == false
  71.           # Desconsiderar se o Modo de Depuração estiver ON e a tecla Ctrl
  72.           # pressionada
  73.           unless $DEBUG and Input.press?(Input::CTRL)
  74.             # Diminuir 1 do contador de encontros
  75.             if @encounter_count > 0
  76.               @encounter_count -= 1
  77.             end
  78.           end
  79.         end
  80.       end
  81.       # Se o botão C for pressionado
  82.       if Input.trigger?(Input::C)
  83.         # Determinantes de mesma posição e na frente do Evento
  84.         check_event_trigger_here([0])
  85.         check_event_trigger_there([0,1,2])
  86.       end
  87.     end
  88.   end
  89. end
Add Comment
Please, Sign In to add comment