IceDragon200

BAR STUFF

Jul 31st, 2011
177
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 1.55 KB | None | 0 0
  1. class Window_Base < Window
  2.  
  3.   HP_BAR_STUFF = [0, WLH-4, 2] # //[x_offset, y_offset, height]
  4.   MP_BAR_STUFF = [0, WLH-4, 2] # //[x_offset, y_offset, height]
  5.  
  6.   #--------------------------------------------------------------------------
  7.   # * Draw HP gauge
  8.   #     actor : actor
  9.   #     x     : draw spot x-coordinate
  10.   #     y     : draw spot y-coordinate
  11.   #     width : Width
  12.   #--------------------------------------------------------------------------
  13.   def draw_actor_hp_gauge(actor, x, y, width = 120)
  14.     gw = width * actor.hp / actor.maxhp
  15.     gc1 = hp_gauge_color1
  16.     gc2 = hp_gauge_color2
  17.     self.contents.fill_rect(x + HP_BAR_STUFF[0], y + HP_BAR_STUFF[1],
  18.      width, HP_BAR_STUFF[2], gauge_back_color)
  19.     self.contents.gradient_fill_rect(x + HP_BAR_STUFF[0], y + HP_BAR_STUFF[1],
  20.      gw, HP_BAR_STUFF[2], gc1, gc2)
  21.   end
  22.  
  23.   #--------------------------------------------------------------------------
  24.   # * Draw MP Gauge
  25.   #     actor : actor
  26.   #     x     : draw spot x-coordinate
  27.   #     y     : draw spot y-coordinate
  28.   #     width : Width
  29.   #--------------------------------------------------------------------------
  30.   def draw_actor_mp_gauge(actor, x, y, width = 120)
  31.     gw = width * actor.mp / [actor.maxmp, 1].max
  32.     gc1 = mp_gauge_color1
  33.     gc2 = mp_gauge_color2
  34.     self.contents.fill_rect(x + MP_BAR_STUFF[0], y + MP_BAR_STUFF[1],
  35.      width, MP_BAR_STUFF[2], gauge_back_color)
  36.     self.contents.gradient_fill_rect(x + MP_BAR_STUFF[0], y + MP_BAR_STUFF[1],
  37.      gw, MP_BAR_STUFF[2], gc1, gc2)
  38.   end
  39.  
  40. end
Advertisement
Add Comment
Please, Sign In to add comment