Bom como não tinha nada para fazer acabei fazendo essa hud que não vó usar mais quem quiser usar so e colocar os créditos da hud bom o design não e um dos melhores mais so vc melhorar ela
*Imagens Nesecarias*
- Spoiler:
- Coloque todas as Imagens na pasta Pictures do seu ProjetoChame essa img de Base_HUD ->Chame essa img de HP-BAR ->Chame essa img de MP-BAR ->Chame essa de XP-BAR ->
*Print de Como Fica*
- Spoiler:
E por ultimo o script
- Código:
#==============================================================================
# ** Hud
#------------------------------------------------------------------------------
# By Valentine
# Modified By Zero
#==============================================================================
class Hud < Sprite
def initialize
super()
self.bitmap = bitmap = Bitmap.new(500-5,120-10)
self.x = +5+4
self.y = -5-3
self.z = 999
refresh
end
def update
super
refresh if something_changed?
if $game_player.x >= self.x/32 and $game_player.x <= self.bitmap.width/32 and $game_player.y >= self.y/32 and $game_player.y <= self.bitmap.height/32 and self.opacity != 150
self.opacity = 150
elsif $game_player.x < self.x/32 or $game_player.x > self.bitmap.width/32 or $game_player.y < self.y/32 or $game_player.y > self.bitmap.height/32 and self.opacity == 150
self.opacity = 255
end
end
#--------------------------------------------------------------------------
# * Atualização
#--------------------------------------------------------------------------
def refresh
@actor = $game_party.actors[0]
@old_exp = @actor.now_exp
@old_hp = @actor.hp
@old_sp = @actor.sp
self.bitmap.clear
self.bitmap.font.size = 14
self.bitmap.font.name = "Segoe UI"
# Base Geral
hud3 = RPG::Cache.picture("Base_HUD")
hud1 = hud3.width
hud2 = hud3.height
hud4 = Rect.new(0,0,hud1,hud2)
self.bitmap.blt(1,16,hud3,hud4)
# Hp
self.bitmap.font.color = Color.new(0,0,0)
hpbar = RPG::Cache.picture("HP-BAR")
hpbarwidth = hpbar.width * @actor.hp / @actor.maxhp
hpbarheight = hpbar.height
hpbar_rect = Rect.new(0,0,hpbarwidth-1,hpbarheight)
self.bitmap.blt(12,39-7-8,hpbar,hpbar_rect)
# Sp
self.bitmap.font.color = Color.new(0,0,0)
mpbar = RPG::Cache.picture("MP-BAR")
mpbarwidth = mpbar.width * @actor.sp / @actor.maxsp
mpbarheight = mpbar.height
mpbar_rect = Rect.new(0,0,mpbarwidth-1,mpbarheight)
self.bitmap.blt(12,57-7-1,mpbar,mpbar_rect)
# Exp
self.bitmap.font.color = Color.new(0,0,0)
if $game_party.actors[0].level != 99
xpbar = RPG::Cache.picture("XP-BAR")
xpbarwidth = xpbar.width * @actor.now_exp / @actor.next_exp
xpbarheight = xpbar.height
xpbar_rect = Rect.new(0,0,xpbarwidth-1,xpbarheight)
self.bitmap.blt(12,76-1,xpbar,xpbar_rect)
#Nome
self.bitmap.font.color = Color.new(255,255,255)
sprect2 = Rect.new(-185, 86, self.bitmap.width - 8, 32)
self.bitmap.draw_text(sprect2, "#{$game_party.actors[0].name}", 1)
#Level
self.bitmap.font.color = Color.new(255,255,255)
sprect3 = Rect.new(-95+1, 86, self.bitmap.width - 8, 32)
self.bitmap.draw_text(sprect3, "#{@actor.level}", 1)
end
end
def something_changed?
return true if @old_exp != @actor.now_exp
return true if @old_hp != @actor.hp
return true if @old_sp != @actor.sp
return false
end
end
class Scene_Map
alias hud_main main
def main
@Hud = Hud.new
hud_main
@Hud.dispose
end
alias hud_update update
def update
hud_update
@Hud.refresh if @Hud.something_changed?
end
end
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
def next_exp
return @exp_list[@level+1] > 0 ? @exp_list[@level+1] - @exp_list[@level] : 0
end
end
*Creditos*
Zero por Fazer a HUD
Valentine por Fazer o NP 4.9.1