if you would like an example of a really simple hud i made for a friend like a year ago. it is 100% plug and play, user just needs graphics. before someone gets all pissy let me say it: my update should not call refresh unless something changed, instead it is called every frame which could slow things down, but since its so simple it really doesn't give any issues, so i never fixed it.
[rgss]
#==============================================================================
# ** Plague180_Hud
#------------------------------------------------------------------------------
# This class draws a simple hud.
#==============================================================================
class MainHud < Window_Base
def initialize
super(-10,-10,175,480)
self.contents = Bitmap.new(width, height)
self.contents.font.size = 16
self.opacity = 0
self.windowskin = nil
self.z = 1000
refresh
end
def refresh
self.contents.clear
draw_hud
draw_text
end
def update
refresh
end
def draw_hp_bar(x, y,current,to_next,width = 176)
bar_y = y + (Font.default_size * 2 /3)
@skin = RPG::Cache.windowskin("HPMeter")
@width = @skin.width
@height = @skin.height / 3
src_rect = Rect.new(0, 0, @width, @height)
self.contents.blt(x , bar_y, @skin, src_rect)
@line = (current == 100 ? 2 : 1)
@amount = (100 == 0 ? 0 : 100 * current / to_next)
src_rect2 = Rect.new(0, @line * @height, @width * @amount / 100, @height)
self.contents.blt(x, bar_y, @skin, src_rect2)
end
def draw_exp_bar(x, y,current,to_next,width = 176)
bar_y = y + (Font.default_size * 2 /3)
@skin = RPG::Cache.windowskin("EXPMETER")
@width = @skin.width
@height = @skin.height / 3
src_rect = Rect.new(0, 0, @width, @height)
self.contents.blt(x , bar_y, @skin, src_rect)
@line = (current == 100 ? 2 : 1)
@amount = (100 == 0 ? 0 : 100 * current / to_next)
src_rect2 = Rect.new(0, @line * @height, @width * @amount / 100, @height)
self.contents.blt(x, bar_y, @skin, src_rect2)
end
def draw_hud
for i in 0...$game_party.actors.size
bitmap = RPG::Cache.picture("Size2")
@actor = $game_party.actors
charcurrent = @actor.now_exp
chartonext = charcurrent + @actor.next_rest_exp_s.to_i
cx = (i*55)
self.contents.blt(0, 20+cx, bitmap, Rect.new(0, 0, 175,100))
self.contents.font.color = Plague180_Color.get_color(1)
self.contents.font.bold = true
self.draw_hp_bar(7,16+cx, @actor.hp, @actor.maxhp)
self.draw_exp_bar(7,27+cx, charcurrent, chartonext)
end
def draw_text
for i in 0...$game_party.actors.size
@actor = $game_party.actors
cx = (i*55)
charcurrent = @actor.now_exp
chartonext = charcurrent + @actor.next_rest_exp_s.to_i
charhp = "Hp: " + @actor.hp.to_s + "/" + @actor.maxhp.to_s
charexp = charcurrent.to_s + "/" +chartonext.to_s
hpcenter = 110 - (charhp.length * 6)
expcenter = 70 - (charexp.length * 6)
charname = @actor.name
charclass = @actor.class_name
charnamespace = charname + "(" + charclass + ")"
charcenter = 120 - (charnamespace.length * 6)
self.contents.draw_text(charcenter,12+cx, 175, 32, charnamespace)
self.contents.font.size = 12
self.contents.draw_text(hpcenter,22+cx,175,32, charhp)
self.contents.draw_text(expcenter,33+cx,175,32, "Exp: " + charexp)
end
end
end
end
#===============================================================================
# Game_Actor
#===============================================================================
class Game_Actor < Game_Battler
def now_exp
return @exp - @exp_list[@level]
end
end
#===============================================================================
# Scene_Map
#===============================================================================
class Scene_Map
alias plague180_hud_main main
alias plague180_hud_update update
def main
@hud = MainHud.new
plague180_hud_main
@hud.dispose
end
def update
@hud.update
plague180_hud_update
end
end
[/rgss]
if you want the graphics to play with this let me know(or you could make your own). i couldn't find the size2 graphic but here is what it looks like more or less.