I can't manage to get animate() to work properly on my Show_Damage() proc:
Code:
#define DMG_Font_Width 14
mob/proc
Show_Damage(var/Damage)
var
Num_Pos = 1
Num_Length = length(Damage)
while(Num_Pos<Num_Length+1)
var/Number = copytext(Damage, Num_Pos, Num_Pos+1)
var/image/i = image('Damage_Font.dmi',"[Number]",pixel_y = 36, layer = MOB_LAYER+2)
switch(Num_Length)
if(1)
i.pixel_x = Num_Pos * DMG_Font_Width - 4
if(2)
i.pixel_x = Num_Pos * DMG_Font_Width - 12
if(3)
i.pixel_x = Num_Pos * DMG_Font_Width - 18
src.overlays += i
Num_Pos += 1
spawn(10) src.overlays -= i
I have tried putting it in various places such as:
src.overlays += i
animate(i, alpha=0, pixel_y=64, time=5)
And:
if(1)
i.pixel_x = Num_Pos * DMG_Font_Width - 4
animate(i, alpha=0, pixel_y=64, time=5)
Both which end up making my code nonfunctional.
Any help would be appreciated.. :)
Images attached this way must be explicitly displayed to specific clients. If you had a reference to the attacker, you could display the number only to the mobs involved:
Or you could probably simply display it to every client in the world, as an overlay would be: