Autor: Arkheron
Olá membros
Eu criei uma HUD. (U.U milagre!) e o melhor: Ela não necessita imagem NENHUMA!
Aqui está o código:
Agora a imagem da HUD:
Agradeço eternamente Sladexd por fazer a aula
Olá membros
Eu criei uma HUD. (U.U milagre!) e o melhor: Ela não necessita imagem NENHUMA!
Aqui está o código:
- Spoiler:
- Código:
class Window_HUD < Window_Base
def initialize(x,y,l,a)
super(x,y,l,a)
@x,@y,@l,@a = x,y,l,a
self.opacity = 0
refresh
end
def refresh
self.contents.clear
@personagem = $game_party.members[0]
@hp = @personagem.hp
@mp = @personagem.mp
@hp_max = @personagem.maxhp
@mp_max = @personagem.maxmp
self.contents.fill_rect(0,0, 104, 13,Color.new(0,0,0))
self.contents.fill_rect(2, 2, 100, 9,Color.new(70,70,70))
self.contents.gradient_fill_rect(2, 2, [email=100*@hp/@hp_max]100*@hp/@hp_max[/email], 9,Color.new(70,0,0),Color.new(255,0,0))
self.contents.fill_rect(0, 15, 104, 13,Color.new(0,0,0))
self.contents.fill_rect(2, 17, 100, 9,Color.new(70,70,70))
self.contents.gradient_fill_rect(2, 17,100*@mp/@mp_max, 9,Color.new(0,0,70),Color.new(0,0,255))
self.contents.font.name = "Calibri"
self.contents.font.size = 10
self.contents.draw_text(3,-1,self.width - 30,15,"HP:")
self.contents.draw_text(3,14,self.width - 30,15,"MP:")
self.contents.draw_text(50,-3,self.width - 30,19,"/")
self.contents.draw_text(50,11,self.width - 30,19,"/")
self.contents.font.size = 11
self.contents.draw_text(29,-4,self.width - 30,19,"[email=#{@hp]#{@hp[/email]}")
self.contents.draw_text(29,11,self.width - 30,19,"[email=#{@mp]#{@mp[/email]}")
self.contents.draw_text(56,-4,self.width - 30,19,"[email=#{@hp_max]#{@hp_max[/email]}")
self.contents.draw_text(56,11,self.width - 30,19,"[email=#{@mp_max]#{@mp_max[/email]}")
end
end
class Scene_Map < Scene_Base
alias hud_start start
def start
@hud = Window_HUD.new(0,0,544,416)
@actor = $game_party.members[0]
@data = []
@data[0] = @actor.hp
@data[1] = @actor.maxhp
@data[2] = @actor.mp
@data[3] = @actor.maxmp
hud_start
end
alias hud_update update
def update
if @data[0] != @actor.hp or @data[1] != @actor.maxhp or @data[2] != @actor.mp or @data[3] = @actor.maxmp or @data[4] != @actor.exp or @data[5] = @actor.next_rest_exp_s
@hud.refresh
end
hud_update
end
alias hud_terminate terminate
def terminate
@hud.dispose
hud_terminate
end
end
Agora a imagem da HUD:
- Spoiler:
Agradeço eternamente Sladexd por fazer a aula