ID:163140
 
Sure I can over lay an icon usr.overlays += 'test.dmi'
But what about icon states? My game is starting to have to many seperate files for overlays.. I want to trim this down.
Please help. Is it possible to overlay an icon state?
obj
overlays
icon='overlays.dmi'
test/icon_state="test"
hat/icon_state="hat"

usr.overlays+=/obj/overlays/test
In response to Ripiz
Overlays could be a pain in the ass in the future so get the crashLays by Crashed for simpler use of overlays.
mob
var/overlay
...
var/I=icon('test.dmi',"icon state")
overlay=I
overlays+=I
..
overlays-=overlay
//or
overlays=null
Hellonagol wrote:
Please help. Is it possible to overlay an icon state?

Yep. It's even possible to put overlays at different "layers". For instance, you can make armour appear over your shirt.

overlays+=image(icon='icons/myicon.dmi',icon_state="armor.dmi',layer=-1)
overlays+=image(icon='icons/myicon.dmi',icon_state="shirt",layer=-2) //appears below armor, but above the mob


Look up FLOAT_LAYER. And use images to add/remove overlays.

-- Data
In response to Android Data
well i use this for my overlays...

mob
verb
shoot() //or whatever
var/icon/C = new('icon.dmi',"overlay")
src.overlays += C


that's about it... hope you like it! :)
In response to Jman9901
Jman9901 wrote:
well i use this for my overlays...

Your method is wrong -- creating a new /icon object just to add an overlay is a very bad habit; it will cause the game to open the icon file for editing. Opening an icon file for editing takes up way more CPU than opening an icon file for reading, like the passive /image type does.

Also, your /icon type will not allow you to layer your icons using the method I described above, nor will they allow you to use pixel offsets with your icons very easily.

-- Data
In response to Android Data
oh, well i just used what someone else told me and no one corrected him so i assumed he was right... sorry for giving a bad example...