Advertisement
Rafael_Sol_Maker

RAFAEL_SOL_MAKER's VX SMOOTH WINDOW OPENING v1.0

Nov 17th, 2011
512
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.66 KB | None | 0 0
  1. #===============================================================================
  2. #             RAFAEL_SOL_MAKER's VX SMOOTH WINDOW OPENING v1.0
  3. #-------------------------------------------------------------------------------
  4. # Description:  A simple special effect that make the window fades softly while
  5. #               it's opening and closing. It halves down the speed of the
  6. #               opening and closing animation, to create a more smooth effect.
  7. #-------------------------------------------------------------------------------
  8. # How to Use: -
  9. #-------------------------------------------------------------------------------
  10. # Special Thanks: -
  11. #-------------------------------------------------------------------------------
  12. #===============================================================================
  13.  
  14. class Window_Base < Window
  15.   attr_accessor :update_opacity
  16.  
  17.   alias vx_smooth_window_initialize initialize unless $@  
  18.   def initialize (x, y, width, height)
  19.     vx_smooth_window_initialize (x, y, width, height)
  20.     @update_opacity = true
  21.   end
  22.  
  23.   def update    
  24.     super
  25.     if @opening
  26.       self.openness += 24
  27.       @opening = false if self.openness == 255
  28.     elsif @closing
  29.       self.openness -= 24
  30.       @closing = false if self.openness == 0
  31.     end    
  32.     if (@opening or @closing) and @update_opacity
  33.       self.opacity = self.openness
  34.       self.back_opacity = self.openness
  35.     end
  36.   end
  37.  
  38. end
  39.  
  40. class Window_Message < Window_Selectable
  41.   alias vx_smooth_window_update update unless $@  
  42.   def update  
  43.     @background == 0 ? @update_opacity = true : @update_opacity = false  
  44.     vx_smooth_window_update
  45.   end  
  46. end
  47.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement