Advertisement
LeonMMS

LM² - Persistent XY Variables - Variáveis XY Persistentes

Apr 2nd, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.65 KB | None | 0 0
  1. #       LM² - Persistent XY Variables - Variáveis XY Persistentes
  2. #            26/02/18 - by LeonM²
  3. # En:
  4. #   Set Player X and Y to chosen variables
  5. #  Just change the variables index on the module bellow
  6. #  Two extra variables to put real X and Y (*32)
  7. # Pt-Br:
  8. #   Coloca a posição X e Y do jogador nas variáveis selecionadas
  9. #  Apenas mude as o índice das variáveis no módulo abaixo
  10. #  Há duas variáveis extras com o valor real X e Y
  11. module LMM
  12.   # X Variable index || Índice da variável X
  13.   XV = 1
  14.   # Y Variable index || Índice da variável Y
  15.   YV = 2
  16.   # Toggle Real X and Y || Ativar valor real X e Y
  17.   RXY = true
  18.   # Real X Variable index || Índice da variável real X
  19.   RXV = 3
  20.   # Real Y Variable index || Índice da variável real Y
  21.   RYV = 4
  22.   # Real X and Y Multiplier  || Multiplicador do X e Y Real
  23.   # (X and Y * value bellow) || (X e Y * valor abaixo)
  24.   RM = 32
  25. end
  26. class Game_Player < Game_Character
  27.   alias lmm_update_gp update
  28.   def update
  29.     lmm_update_gp
  30.     $game_variables[LMM::XV] = @x if $game_variables[LMM::XV] != @x
  31.     $game_variables[LMM::YV] = @y if $game_variables[LMM::YV] != @y
  32.     if LMM::RXY
  33.       mx = @x * LMM::RM
  34.       $game_variables[LMM::RXV] = mx if $game_variables[LMM::RXV] != mx
  35.       my = @y * LMM::RM
  36.       $game_variables[LMM::RYV] = my if $game_variables[LMM::RYV] != my
  37.     end
  38.   end
  39.   alias lmm_moveto_gp moveto
  40.   def moveto(x, y)
  41.     lmm_moveto_gp(x, y)
  42.     $game_variables[LMM::XV] = x
  43.     $game_variables[LMM::YV] = y
  44.     if LMM::RXY
  45.       mx = x * LMM::RM
  46.       $game_variables[LMM::RXV] = mx
  47.       my = y * LMM::RM
  48.       $game_variables[LMM::RYV] = my
  49.     end
  50.   end
  51. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement