ID:271165
 
ok i have this below and i need to make this from a mob into a overlay so that it doesnt interfere with interactions of other mobs.

THIS IS MAIN CODE:
mob/Shadow
density = 0
proc/Shadow()
..()
spawn while(2)
sleep(1)
for(var/mob/O in world)
if(src.owner==O)
src.icon -= rgb(2500,2500,2500)


New()
src.Shadow()

mob/var/bottom = 0
mob/Move()
..()
for(var/mob/Shadow/O in world)
if(O.owner==usr)
O.loc = locate(usr.x,usr.y-1,usr.z)
O.dir = usr.dir
if(usr.y==0)
usr.bottom = 1

world.New()
BottomShadow()

proc/BottomShadow()
spawn while(2)
sleep(3)
for(var/mob/Shadow/O in world)
if(O.x==0 && O.y==0 && O.z==0)
var/mob/P = O.owner
O.loc = locate(P.x,P.y-1,P.z)


THIS IS INITIAL CODE TO CREATE:
var/mob/O = new/mob/Shadow(usr.x,usr.y-1,usr.z)
O.name = "[usr]'s Shadow"
O.owner = usr

O.icon = usr.icon
O.icon_state = usr.icon_state
var/icon/I = new(O.icon,O.icon_state)
I.Flip(NORTH)
O.icon = I
O.icon += rgb(20,20,20)
EEEEEEEEEEEW! At any case, scrap that horrible mess immediately.

Anyway, what you want is a pixel-offsetted overlay. Look up the 'pixel_y' and 'pixel_x' vars and the 'overlays' var.
In response to Kaioken
i know of the pixel_y and x, i use it for my status bars thank you.

the problem is if i make it a plan overlay i cannot change the rbg and will need to use a black icon which i wonted the icon to be an exact replica of the player (including movement which it does).




kaio- as much as i appreciate the effort you seen to be much more of a downer than helpful in peoples posts IMO
In response to Chase_Hammer
Chase_Hammer wrote:
i know of the pixel_y and x, i use it for my status bars thank you.

No problem mate. What I referred to was different though; which you may know or not - using an overlay a tile off (ie in your case, a tile under) the source atom.

the problem is if i make it a plan overlay i cannot change the rbg

You can. You will have to keep a reference to the icon added to overlays (so you can remove it later), then when wanting to update it, create a new appropriate icon, remove the old one from overlays then add the new one (and keep a reference to it too, of course).

I could be more specific, but you should get it from now. Otherwise, just ask...which you will anyway, but hey.

kaio- as much as i appreciate the effort you seen to be much more of a downer than helpful in peoples posts IMO

I could oppose that, but no reason to since I don't care about that opinion. Think what you want.
Relatedly, I'm usually frank in posts (unless that frank-iness goes against the board rules, which it sometimes does ;D) and post my opinion. Sometimes I'm just lazy, but most often at least a little helpful.