Advertisement
neutale

Enemy Scale/Invert

Jan 20th, 2020
709
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.95 KB | None | 0 0
  1. =begin
  2.  
  3. RGSS3 Enemy Scale/Invert 2012/1/19 mo-to
  4.  
  5. TKOOL COOL
  6. http://mototkool.blog.fc2.com/
  7.  
  8. ★Usage★
  9. This script uses overwrite function, and thus if you decide to use the script, put it above all your custom scripts for the best compatibility cases (or edit it yourself so that you could put it anywhere in your script slot)
  10.  
  11. ●In the enemy Note box, put this note tag <scale>.
  12. ●If you use <invert> inside the enemy Note box,
  13. the enemy graphic is flipped horizontal. Can be used together with scaling.
  14.  
  15. Example) <scale 1.5> in the Note box for slime of enemy ID1
  16.   The slime graphic is multiplied by 1.5 during battle.
  17.  
  18. ★Overview★
  19. Scale / Invert effect can be used without directly editing the enemy graphics.
  20.  
  21. ★Note★
  22. Please pay attention to performance of large enemy graphics.
  23. If you use multiple enemies, they will overlap unless you adjust their position.
  24. Due to how redefinition is used, there may be script conflicts.
  25.  
  26. ★RGSS Reference★
  27. Suppon blog 
  28. http://supponweblog.blog88.fc2.com/
  29. Reference of zoom from Game_Battler for Maker XP.
  30.  
  31. =end
  32.  
  33.  
  34. class Game_Enemy < Game_Battler  
  35.   #--------------------------------------------------------------------------
  36.   # ● Public instance variables
  37.   #--------------------------------------------------------------------------
  38.   attr_reader   :zoom                     # Scale enemy characters
  39.   attr_reader   :mirror                   # Invert enemy characters
  40.   #--------------------------------------------------------------------------
  41.   # ● Object initialization * Redefined
  42.   #     index    : Enemy group index
  43.   #     enemy_id : Enemy ID
  44.   #--------------------------------------------------------------------------
  45.   def initialize(index, enemy_id)
  46.     super()
  47.     @index = index
  48.     @enemy_id = enemy_id
  49.     enemy = $data_enemies[@enemy_id]
  50.     @original_name = enemy.name
  51.     @letter = ''
  52.     @plural = false
  53.     @screen_x = 0
  54.     @screen_y = 0
  55.     @battler_name = enemy.battler_name
  56.     @battler_hue = enemy.battler_hue
  57.     @hp = mhp
  58.     @mp = mmp
  59.     @mirror = false
  60.     @zoom = 1
  61.     enemy.note.each_line { |line|
  62.     case line
  63.     when /<scale\s*([0-9]+(\.[0-9]*)?|(\.[0-9]+)?)>/
  64.       @zoom = $1.to_f
  65.     when /<invert>/
  66.       @mirror = true
  67.     end
  68.     }
  69.   end
  70. end
  71.  
  72. class Sprite_Battler < Sprite_Base
  73.   #--------------------------------------------------------------------------
  74.   # ● Object initialization ※ Redefine
  75.   #     viewport
  76.   #     battler  : Game_Battler
  77.   #--------------------------------------------------------------------------
  78.   def initialize(viewport, battler = nil)
  79.     super(viewport)
  80.     @battler = battler
  81.     @battler_visible = false
  82.     @effect_type = nil            # Effect type
  83.     @effect_duration = 0        # Duration/ time
  84.     if battler.class == Game_Enemy
  85.       self.zoom_x = battler.zoom
  86.       self.zoom_y = battler.zoom
  87.       self.mirror = battler.mirror
  88.     end
  89.   end
  90. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement