Advertisement
ForeverZer0

[RMXP] Shade Terrain Tags

Jun 27th, 2012
190
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.28 KB | None | 0 0
  1. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  2. # Shade Terrain Tag
  3. # Author: ForeverZer0
  4. # Version: 1.0
  5. # Date: 6.27.2012
  6. #+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  7. #
  8. # Simply shades characters by blending a color with their sprites whenever they
  9. # are stepping on a tile with a specific terrain tag. Not a whole lote more to
  10. # it than that.
  11. #
  12. # See below to adjust the blend color and terrain tag number.
  13. #
  14. ##+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+
  15.  
  16. #===============================================================================
  17. # ** Game_Character
  18. #===============================================================================
  19.  
  20. class Game_Character
  21.   #-----------------------------------------------------------------------------
  22.   # * Configuration
  23.   #-----------------------------------------------------------------------------
  24.   SHADE_TERRAIN_TAG = 7
  25.   SHADE_COLOR = Color.new(0, 0, 0, 60)
  26.   #-----------------------------------------------------------------------------
  27.   # * Public Instance Variables
  28.   #-----------------------------------------------------------------------------
  29.   attr_reader :shaded
  30.   #-----------------------------------------------------------------------------
  31.   # * Frame Update (alias)
  32.   #-----------------------------------------------------------------------------
  33.   alias shade_terrain_tag_update update
  34.   def update
  35.     @shaded = self.terrain_tag == SHADE_TERRAIN_TAG
  36.     shade_terrain_tag_update
  37.   end
  38. end
  39.  
  40. #===============================================================================
  41. # ** Sprite_Character
  42. #===============================================================================
  43.  
  44. class Sprite_Character
  45.   #-----------------------------------------------------------------------------
  46.   # * Frame Update (alias)
  47.   #-----------------------------------------------------------------------------
  48.   alias shaded_blend_update update
  49.   def update
  50.     if @character.shaded && @blended == nil
  51.       self.color = Game_Character::SHADE_COLOR
  52.       @blended = true
  53.     elsif !@character.shaded && @blended != nil
  54.       self.color = Color.new(0, 0, 0, 0)
  55.       @blended = nil
  56.     end
  57.     shaded_blend_update
  58.   end
  59. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement