Advertisement
LiTTleDRAgo

[RGSS] DRG - Breath Effect

Mar 17th, 2013
724
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.35 KB | None | 0 0
  1. #==============================================================================
  2. # ** DRG - Breath Effect
  3. # Version : 1.01
  4. # Author : LiTTleDRAgo
  5. #==============================================================================
  6. #==============================================================================
  7. # ** Sprite_Character
  8. #------------------------------------------------------------------------------
  9. #  This sprite is used to display the character.It observes the Game_Character
  10. #  class and automatically changes sprite conditions.
  11. #==============================================================================
  12. class Sprite_Character
  13.   #--------------------------------------------------------------------------
  14.   # * Alias Method
  15.   #--------------------------------------------------------------------------
  16.   alias_method :drg1732013_update, :update
  17.   #--------------------------------------------------------------------------
  18.   # * Frame Update
  19.   #--------------------------------------------------------------------------
  20.   def update
  21.     drg1732013_update
  22.     update_breath
  23.   end
  24.   #--------------------------------------------------------------------------
  25.   # * Update Breath
  26.   #--------------------------------------------------------------------------
  27.   def update_breath
  28.     if sprite_controlable?(@character)
  29.       @zoom_wait,b = [(@zoom_wait||0)-1,0].max, 1.05
  30.       @breath = true
  31.       if self.zoom_y < b && !@up && @zoom_wait == 0
  32.         self.zoom_y += 0.005
  33.         @up, @zoom_wait = true, 20 if self.zoom_y >= b
  34.       elsif self.zoom_y >= 1.0 && @up && @zoom_wait == 0
  35.         self.zoom_y -= 0.005
  36.         @up, @zoom_wait = false,60 if self.zoom_y <= 1.0
  37.       end
  38.     elsif @breath
  39.       @breath = false
  40.       self.zoom_y = @character.instance_variable_get(:@zoom_y) || 1
  41.     end
  42.   end
  43.   #--------------------------------------------------------------------------
  44.   # * sprite_controlable?
  45.   #--------------------------------------------------------------------------
  46.   def sprite_controlable?(character)
  47.     return false if $game_system.map_interpreter.running?
  48.     return false if character.move_route_forcing
  49.     return false if $game_temp.message_window_showing
  50.     return false if character.moving?
  51.     return false if character.transparent
  52.     return false if !character.is_a?(Game_Player)
  53.     return true
  54.   end
  55. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement