Advertisement
mikb89

[Ace] Limited Moves v1.1

Jan 6th, 2013
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.80 KB | None | 0 0
  1. # Limited Moves v. 1.1
  2. # VX Ace version
  3. # by mikb89
  4.  
  5. # Dettagli:
  6. #  Questo script permette di limitare i movimenti del giocatore.
  7. #  Via chiama script si possono inserire le istruzioni su quale direzione
  8. #   bloccare o sbloccare.
  9. #  lock_move_right bloccherà i movimenti a destra.
  10. #  unlock_move_down sbloccherà quelli in giù.
  11. #  Metto giusto questi a titolo di esempio, per operare con sinistra e su
  12. #   chiaramente basta sostituire right o down con left per sinistra e up per su.
  13. #  In ogni caso attivando l'opzione sottostante si possono avere i comandi in
  14. #   italiano, molto più comodi, probabilmente ^^
  15.  
  16. # Configurazioni:
  17. module LIMOV
  18.   COMANDI_ITA = true
  19.    # Permette di avere i comandi in italiano come blocca_dx o sblocca_giu
  20. end
  21.  
  22. #Codename: limov
  23.  
  24. ($imported ||= {})[:mikb89_limov] = true
  25.  
  26. # License:
  27. # - You can ask me to include support for other scripts as long as these scripts
  28. #   use the $imported[script] = true;
  29. # - You can modify and even repost my scripts, after having received a response
  30. #   by me. For reposting it, anyway, you must have done heavy edit or porting,
  31. #   you can't do a post with the script as is;
  32. # - You can use my scripts for whatever you want, from free to open to
  33. #   commercial games. I'd appreciate by the way if you let me know about what
  34. #   you're doing;
  35. # - You must credit me, if you use this script or part of it.
  36.  
  37. class Game_Player < Game_Character
  38.   attr_accessor :limovs
  39.   alias_method(:init_b4_limov, :initialize) unless method_defined?(:init_b4_limov)
  40.   def initialize
  41.     init_b4_limov
  42.     @limovs = []
  43.   end
  44.   alias_method(:mv_strait_b4_limov, :move_straight) unless method_defined?(:mv_strait_b4_limov)
  45.   def move_straight(d, turn_ok = true)
  46.     return if @limovs.include?(d)
  47.     mv_strait_b4_limov(d, turn_ok)
  48.   end
  49. end
  50.  
  51. class Game_Interpreter
  52.   def lock_move(m)
  53.     $game_player.limovs << m
  54.     $game_player.limovs.uniq!
  55.   end
  56.   def unlock_move(m)
  57.     $game_player.limovs.delete(m)
  58.     $game_player.limovs.uniq!
  59.   end
  60.  
  61.   def lock_move_right
  62.     lock_move(6)
  63.   end
  64.   def lock_move_left
  65.     lock_move(4)
  66.   end
  67.   def lock_move_up
  68.     lock_move(8)
  69.   end
  70.   def lock_move_down
  71.     lock_move(2)
  72.   end
  73.   def unlock_move_right
  74.     unlock_move(6)
  75.   end
  76.   def unlock_move_left
  77.     unlock_move(4)
  78.   end
  79.   def unlock_move_up
  80.     unlock_move(8)
  81.   end
  82.   def unlock_move_down
  83.     unlock_move(2)
  84.   end
  85.   if LIMOV::COMANDI_ITA
  86.     def blocca_dx
  87.       lock_move(6)
  88.     end
  89.     def blocca_sx
  90.       lock_move(4)
  91.     end
  92.     def blocca_su
  93.       lock_move(8)
  94.     end
  95.     def blocca_giu
  96.       lock_move(2)
  97.     end
  98.     def sblocca_dx
  99.       unlock_move(6)
  100.     end
  101.     def sblocca_sx
  102.       unlock_move(4)
  103.     end
  104.     def sblocca_su
  105.       unlock_move(8)
  106.     end
  107.     def sblocca_giu
  108.       unlock_move(2)
  109.     end
  110.   end
  111. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement