ID:178538
 
I'm trying to add magic effect overlays to my game (sparks flying from hands, etc). If a person is facing left and casts the "whatever" spell, I need my "whatever" spell icon to overlay to the left side of the mob (say -16 pixels). That part's not hard, but how about if the player is facing right? The effect will still be behind the mob. Also, what if the player turns around in the middle of the effect? Is there an easy way around this?





[edit]:

If you don't have a clue, please let me know. I want to move on to other things instead of waiting if no one knows.
So . . . does anybody have any ideas or not?
Gakumerasara wrote:
I'm trying to add magic effect overlays to my game (sparks flying from hands, etc). If a person is facing left and casts the "whatever" spell, I need my "whatever" spell icon to overlay to the left side of the mob (say -16 pixels). That part's not hard, but how about if the player is facing right? The effect will still be behind the mob. Also, what if the player turns around in the middle of the effect? Is there an easy way around this?

So you want to put it half a tile in front of the player? That should be easy enough:
obj/magic
New(newloc,mob/M)
..()
if(M.dir&EAST) pixel_x=16
else if(M.dir&WEST) pixel_x=-16
if(M.dir&NORTH) pixel_y=16
else if(M.dir&SOUTH) pixel_y=-16

Lummox JR
In response to Lummox JR
I think that's just what I needed; thanks for your help.