Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Sprite_HUD
- #------------------------------------------------------------------------------
- # Autor: Valentine
- # Modifield: Komuro Takashi 16/04/2019
- #==============================================================================
- class Sprite_HUD < Sprite
- def initialize
- super
- self.bitmap = Bitmap.new(308, 107)
- self.x = 11
- self.y = 9
- self.z = 50
- self.bitmap.font.size = 18
- self.bitmap.font.bold = true
- @back = Cache.system('HUD_01_PNG')
- @bars = Cache.system('EXP_BARS_PNG')
- refresh
- end
- def dispose
- super
- @exp_sprite.bitmap.dispose
- @exp_sprite.dispose
- end
- def refresh
- draw_background
- draw_face
- draw_hp_bar
- draw_mp_bar
- draw_exp_bar
- draw_level
- end
- def draw_background
- self.bitmap.clear
- rect = Rect.new(0, 0, 308, 98)
- self.bitmap.blt(7, 0, @back, rect)
- end
- def draw_face
- face = Cache.face($game_actors[1].face_name)
- rect = Rect.new($game_actors[1].face_index % 4 * 96, $game_actors[1].face_index / 4 * 96, 96-8, 96-12)
- self.bitmap.blt(8, 0, face, rect)
- end
- def draw_hp_bar
- rect = Rect.new(0, 0, 185 * $game_actors[1].hp / $game_actors[1].mhp, 24)
- self.bitmap.blt(107, 11, @bars, rect)
- self.bitmap.draw_text(111, 16, 25, 18, Vocab::hp_a)
- self.bitmap.draw_text(0, 16, 229, 16, "#{$game_actors[1].hp}/#{$game_actors[1].mhp}", 2)
- end
- def draw_mp_bar
- rect = Rect.new(0, 26, 184 * $game_actors[1].mp / $game_actors[1].mmp, 24)
- self.bitmap.blt(107, 30, @bars, rect)
- self.bitmap.draw_text(111, 35, 25, 18, Vocab::mp_a)
- self.bitmap.draw_text(0, 35, 229, 16, "#{$game_actors[1].mp}/#{$game_actors[1].mmp}", 2)
- end
- def draw_exp_bar
- rect = Rect.new(0, 52, 184 * $game_actors[1].now_exp / $game_actors[1].next_exp, 24)
- self.bitmap.blt(107, 50, @bars, rect)
- self.bitmap.draw_text(111, 54, 25, 18, Vocab::Exp)
- self.bitmap.draw_text(0, 54, 229, 16, "#{$game_actors[1].now_exp}/#{$game_actors[1].next_exp - $game_actors[1].now_exp}",2)
- end
- def draw_level
- rect = Rect.new(0, 124, 29, 30)
- self.bitmap.blt(0, 77, @back, rect)
- self.bitmap.draw_text(0, 83, 30, 18, $game_actors[1].level, 1)
- end
- def update
- super
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement