mob
soldiers
proc
Update_Screen()
src.health_count.overlays = 0
src.pri_ammo_count.overlays = 0
src.sec_ammo_count.overlays = 0
var/list/h_num = Cut_Into_Pieces(num2text(src.health))
var/obj/hud/numbers/h_num_1 = new/obj/hud/numbers
var/obj/hud/numbers/h_num_2 = new/obj/hud/numbers
if(h_num.len < 1)
src.health_count.icon_state = "0b red"
h_num_1.icon_state = "0b red"
h_num_2.icon_state = "0b red"
else if(h_num.len<2)
src.health_count.icon_state = "0b red"
h_num_1.icon_state = "0b red"
h_num_2.icon_state = "[h_num[1]]b"
else if(h_num.len<3)
src.health_count.icon_state = "0b red"
h_num_1.icon_state = "[h_num[1]]b"
h_num_2.icon_state = "[h_num[2]]b"
else
src.health_count.icon_state = "[h_num[1]]b"
h_num_1.icon_state = "[h_num[2]]b"
h_num_2.icon_state = "[h_num[3]]b"
h_num_1.pixel_x += 7
h_num_2.pixel_x += 14
src.health_count.overlays += h_num_1
src.health_count.overlays += h_num_2
var/list/p_num = Cut_Into_Pieces(num2text(src.prime_ammo))
var/obj/hud/numbers/p_num_1 = new/obj/hud/numbers
if(p_num.len < 1)
src.pri_ammo_count.icon_state = "0c red"
p_num_1.icon_state = "0c red"
else if(p_num.len<2)
src.pri_ammo_count.icon_state = "0c red"
p_num_1.icon_state = "[p_num[1]]c"
else
src.pri_ammo_count.icon_state = "[p_num[1]]c"
p_num_1.icon_state = "[p_num[2]]c"
p_num_1.pixel_x += 11
src.pri_ammo_count.overlays += p_num_1
var/list/s_num = Cut_Into_Pieces(num2text(src.second_ammo))
var/obj/hud/numbers/s_num_1 = new/obj/hud/numbers
if(s_num.len < 1)
src.sec_ammo_count.icon_state = "0a red"
s_num_1.icon_state = "0a red"
else if(s_num.len<2)
src.sec_ammo_count.icon_state = "0a red"
s_num_1.icon_state = "[s_num[1]]a"
else
src.sec_ammo_count.icon_state = "[s_num[1]]a"
s_num_1.icon_state = "[s_num[2]]a"
s_num_1.pixel_x += 11
src.sec_ammo_count.overlays += s_num_1
Problem description:
I'm trying to make a HUD that tracks multiple mob statistics (health and ammunition) but I keep running into trouble. I have the positioning correct, the update correct but for some reason, whenever the player moves to the east slowly the overlays I'm using for numbers dissapear for a bit then reapear.
No doubt there is a better way to do this, but I gave it a go and now I'm stuck with it.
Any help / corrections / suggestions would be greatly appreciated.
- GunRunner
**********************************
I fixed the flickery thing, it was a layer issue that I had not been able to catch. Still wondering if there's any thing that could make this code better.
Thanks again!