Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #==============================================================================
- # ** Sprite_HUD
- #------------------------------------------------------------------------------
- # Autor: Valentine
- #==============================================================================
- #** HUD Modificada
- #==============================================================================
- # Modificado por: Senbonzakura
- #==============================================================================
- class Sprite_HUD < Sprite
- def initialize
- super
- self.bitmap = Bitmap.new(600, 600) # Tamanho da tela da HUD
- self.x = 240 # Posição X da HUD
- self.y = 399 # POsição Y da HUD
- self.z = 0 # Profundidade da HUD
- self.bitmap.font.size = 18 # Tamanho da fonte
- self.bitmap.font.bold = true # Fonte c/ Bold ou não
- @back = Cache.system('HUD') # Imagem da Barra de HUD
- @HP_bar = Cache.system('Hp_Bar') # Imagem da Barra de HP
- @MP_bar = Cache.system('Mp_Bar') # Imagem da Barra de MP
- @XP_bar = Cache.system('Xp_Bar') # Imagem da Barra de EXP
- create_exp_bar
- refresh
- end
- def dispose
- super
- @exp_sprite.bitmap.dispose
- @exp_sprite.dispose
- end
- def create_exp_bar
- @exp_sprite = Sprite2.new
- @exp_sprite.bitmap = Bitmap.new(600,3) # Tamanho da tela da HUD
- @exp_sprite.bitmap.font.size = 28 # Tamanho da Fonte da Letra
- @exp_sprite.bitmap.font.bold = true # Letra em Negrito ou não
- @exp_sprite.x = Graphics.width - 173 # Posição X da Barra de EXP
- @exp_sprite.y = Graphics.height - 4 # Posição Y da Barra de EXP
- @exp_sprite.dragable = false
- @exp_sprite.z = self.z
- end
- def refresh
- draw_background
- draw_hp_bar
- draw_mp_bar
- draw_exp_bar
- draw_level
- end
- def draw_background
- self.bitmap.clear
- rect = Rect.new(0, 0, 640, 480) # Tamanho da tela da em aparece todos itens da hud
- self.bitmap.blt(7, 0, @back, rect)
- end
- def draw_hp_bar
- # self.bitmap.blt(X, Y, @HP_bar, Rect.new(Altura, Largura, @HP_bar.width, @HP_bar.height * $game_actors[1].hp / $game_actors[1].mhp))
- self.bitmap.blt(30, 6, @HP_bar.angle = 180, Rect.new(0, 0, 100 / @HP_bar.width , @HP_bar.height * $game_actors[1].hp / $game_actors[1].mhp))
- def draw_mp_bar
- # self.bitmap.blt(X, Y, @MP_bar, Rect.new(Altura , Largura, @MP_bar.width , @MP_bar.height * $game_actors[1].mp / $game_actors[1].mmp))
- self.bitmap.blt(142, 6, @MP_bar, Rect.new(0, 0, 100 / @MP_bar.width , @MP_bar.height * $game_actors[1].mp / $game_actors[1].mmp))
- end
- def draw_exp_bar
- @exp_sprite.bitmap.clear
- rect1 = Rect.new(0, 98, @exp_sprite.bitmap.width, @exp_sprite.bitmap.height)
- rect2 = Rect.new(0, 0, 170 * $game_actors[1].now_exp / $game_actors[1].next_exp, 26) # " 170 " é o comprimento da Barra EXP#
- exp = $game_actors[1].level >= Configs::MAX_LEVEL ? Vocab::MaxLevel : $game_actors[1].next_exp - $game_actors[1].now_exp
- @exp_sprite.bitmap.blt(0, 0, @back, rect1)
- @exp_sprite.bitmap.blt(0, 0, @XP_bar, rect2)
- end
- def draw_level
- rect = Rect.new(0, 600, 29, 30)
- self.bitmap.blt(0, 77, @back, rect)
- self.bitmap.draw_text(600, 10, 30, 18, $game_actors[1].level, 1)
- end
- def update
- super
- @exp_sprite.update
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement