ID:169241
 
How would I go about making it so the old HUD display is deleted, and then updated with a new one?

My code works, but the user's new health just goes over the old one and it looks really screwed up:

client/proc/AddHUD(a as text)
if(a == "Health")
var/iconset/s = font.DrawText("[usr.health]%")
s.Transparent()
s.Blend(rgb(0, 255, 0), ICON_MULTIPLY)
var/obj/hud/O
for(var/i = 0, i < s.w, ++i)
O=new(src)
var/icon/ic = s.GetIcon(i, 0)
if(ic)
O.icon = ic
O.screen_loc = "[5+i],13"
mob
var
health = 10
verb
addhealth()
usr.health ++
usr.client.AddHUD("Health")
delhealth()
usr.health --
usr.client.AddHUD("Health")


I already searched for HUD on the forums and didn't find anything that helped me. =/
client/proc/AddHUD(a as text)
if(a == "Health")
var/iconset/s = font.DrawText("[usr.health]%")
s.Transparent()
s.Blend(rgb(0, 255, 0), ICON_MULTIPLY)
for(var/obj/hud/health/O in screen)
del(O)//delete all the health hud things in the screen
var/obj/hud/health/O
for(var/i = 0, i < s.w, ++i)
O=new(src)
var/icon/ic = s.GetIcon(i, 0)
if(ic)
O.icon = ic
O.screen_loc = "[5+i],13"
obj/hud/health//put your health hud stuff here plz
In response to CIB
thanks, it works.