ID:151100
 
ive got the health meter to appear as an overlay over top of the thing that the player is attacking, the problem is that i cant get it to dissapear again after about 2 sec(using the spawn() proc). ive tried src.overlays -= src.life and del(life) but they dont work. is there any other way of doing it?

obj/life
icon = 'metero.dmi'
icon_state = "0" //that's zero, not ( ) or O
var/num = 0
var/icon_states = 30
proc/Update()
src.icon_state = "[round(src.num)]"
mob
var
obj/life/life


New()
..()
src.life = new /obj/life

mob/proc/hurt()
src.overlays += src.life
src.life.num = (src.health/src.maxhealth)*src.life.icon_states
src.life.Update()