Advertisement
Guest User

HUD_VXA_OS_CUSTOM

a guest
Apr 15th, 2019
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Ruby 2.34 KB | None | 0 0
  1. #==============================================================================
  2. # ** Sprite_HUD
  3. #------------------------------------------------------------------------------
  4. #  Autor: Valentine
  5. #  Modifield: Komuro Takashi 16/04/2019
  6. #==============================================================================
  7.  
  8. class Sprite_HUD < Sprite
  9.  
  10.   def initialize
  11.     super
  12.     self.bitmap = Bitmap.new(308, 107)
  13.     self.x = 11
  14.     self.y = 9
  15.     self.z = 50
  16.     self.bitmap.font.size = 18
  17.     self.bitmap.font.bold = true
  18.     @back = Cache.system('HUD_01_PNG')
  19.     @bars = Cache.system('EXP_BARS_PNG')
  20.     refresh
  21.   end
  22.  
  23.   def dispose
  24.     super
  25.     @exp_sprite.bitmap.dispose
  26.     @exp_sprite.dispose
  27.   end
  28.  
  29.   def refresh
  30.     draw_background
  31.     draw_face
  32.     draw_hp_bar
  33.     draw_mp_bar
  34.     draw_exp_bar
  35.     draw_level
  36.   end
  37.  
  38.   def draw_background
  39.     self.bitmap.clear
  40.     rect = Rect.new(0, 0, 308, 98)
  41.     self.bitmap.blt(7, 0, @back, rect)
  42.   end
  43.  
  44.   def draw_face
  45.     face = Cache.face($game_actors[1].face_name)
  46.     rect = Rect.new($game_actors[1].face_index % 4 * 96, $game_actors[1].face_index / 4 * 96, 96-8, 96-12)
  47.     self.bitmap.blt(8, 0, face, rect)
  48.   end
  49.  
  50.   def draw_hp_bar
  51.     rect = Rect.new(0, 0, 185 * $game_actors[1].hp / $game_actors[1].mhp, 24)
  52.     self.bitmap.blt(107, 11, @bars, rect)
  53.     self.bitmap.draw_text(111, 16, 25, 18, Vocab::hp_a)
  54.     self.bitmap.draw_text(0, 16, 229, 16, "#{$game_actors[1].hp}/#{$game_actors[1].mhp}", 2)
  55.   end
  56.  
  57.   def draw_mp_bar
  58.     rect = Rect.new(0, 26, 184 * $game_actors[1].mp / $game_actors[1].mmp, 24)
  59.     self.bitmap.blt(107, 30, @bars, rect)
  60.     self.bitmap.draw_text(111, 35, 25, 18, Vocab::mp_a)
  61.     self.bitmap.draw_text(0, 35, 229, 16, "#{$game_actors[1].mp}/#{$game_actors[1].mmp}", 2)
  62.   end
  63.  
  64.   def draw_exp_bar
  65.     rect = Rect.new(0, 52, 184 * $game_actors[1].now_exp / $game_actors[1].next_exp, 24)
  66.     self.bitmap.blt(107, 50, @bars, rect)
  67.     self.bitmap.draw_text(111, 54, 25, 18, Vocab::Exp)
  68.     self.bitmap.draw_text(0, 54, 229, 16, "#{$game_actors[1].now_exp}/#{$game_actors[1].next_exp - $game_actors[1].now_exp}",2)
  69.  
  70.   end
  71.  
  72.   def draw_level
  73.     rect = Rect.new(0, 124, 29, 30)
  74.     self.bitmap.blt(0, 77, @back, rect)
  75.     self.bitmap.draw_text(0, 83, 30, 18, $game_actors[1].level, 1)
  76.   end
  77.  
  78.   def update
  79.     super
  80.   end
  81.  
  82. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement