ID:1741600
 
(See the best response by FKI.)
Hi!!! I'm trying to create some screen objects such as hp bar but I am finding problems :((

I have this:
obj/HP_Bar
icon = 'HP Bar.dmi'
icon_state = "100"
layer = 100
screen_loc = "1,1"
New(client/C) {..(); C.screen += src}


It works well but there are some objects that appear over the bar :( I dont know why, their layers are lower than the bars but i cant find a way to fix it, thank you for the help :DD
Hmm, maybe you could show the code for one of these objects that appear above that one? Not much to go on with the information you've provided.
In response to FKI
FKI wrote:
Hmm, maybe you could show the code for one of these objects that appear above that one? Not much to go on with the information you've provided.

I think the hp bar appears over all the existing graphics that are in my screen when I create it, but when new atoms are created they always appear over it even if their layer is much lower :( I dont know why, they are not images either, just objects with icons and layer = 10
In response to Estarqui
Well I just did some testing and that doesn't seem to be the case. My object with a layer of 100 always appeared on top.
In response to FKI
FKI wrote:
Well I just did some testing and that doesn't seem to be the case. My object with a layer of 100 always appeared on top.

How did you add the screen object to the player's screen? Mine's alpha isn't 255 because I want it to be a bit transparent, and I used client.screen += src :/
However when I use images the layer issue doesn't happen.
In response to Estarqui
Best response
Exactly what I used to test:

mob
var
tmp/obj/screenobj

Login()
..()
spawn(10)
var/obj/o = new
o.layer=100
o.alpha=160
o.screen_loc="SOUTH,WEST"
o.icon = 'media/base/base_brown.dmi'
client.screen+=o

verb/addscreenobj()
screenobj = new
screenobj.screen_loc="SOUTH,WEST"
screenobj.icon = 'media/base/base_white.dmi'
client.screen += screenobj

verb/removescreenobj()
client.screen-=screenobj
In response to FKI
Thank you! It worked well :D
In response to Estarqui
Heh, that wasn't meant to be usable code haha.

Out of curiosity, what were you doing that's different from my snippet?