mob/Move(var/turf/NewLoc,NewDir)
if(src.Sprinting && !src.density && NewLoc.Enter(src))
src.AddAura("Fly")
ShowEffect(src.loc,"[src.GetAuraType()]Trail",0,0,NewDir,1)
if(NewDir==9) ShowEffect(src.loc,"[src.GetAuraType()]Trail",16,-16,NewDir,1,0)
if(NewDir==5) ShowEffect(src.loc,"[src.GetAuraType()]Trail",-16,-16,NewDir,1,0)
if(NewDir==10) ShowEffect(src.loc,"[src.GetAuraType()]Trail",16,16,NewDir,1,0)
if(NewDir==6) ShowEffect(src.loc,"[src.GetAuraType()]Trail",-16,16,NewDir,1,0)
return ..()
^that code is to show trail when player fly but only on tiled based when i convert it to pixel movement like this one
mob/Move(var/turf/NewLoc,NewDir)
if(src.Sprinting && !src.density && NewLoc.Enter(src))
src.AddAura("Fly")
ShowEffect(src.loc,"[src.GetAuraType()]Trail",step_x,step_y,NewDir,1)
if(NewDir==9) ShowEffect(src.loc,"[src.GetAuraType()]Trail",px+16,py-16,NewDir,1,0)
if(NewDir==5) ShowEffect(src.loc,"[src.GetAuraType()]Trail",px-16,py-16,NewDir,1,0)
if(NewDir==10) ShowEffect(src.loc,"[src.GetAuraType()]Trail",px+16,py+16,NewDir,1,0)
if(NewDir==6) ShowEffect(src.loc,"[src.GetAuraType()]Trail",px-16,py+16,NewDir,1,0)
return ..()
it just makes those trail appear 2wice between 2 tiles, i just want to know how can i get this fixed?
#2In order to make trails you should really attatch it onto movement() or even better, set_state() since you're displaying something. Move() is still only called when entering a new turf, which explains the since tile issue.
If anything, you may want to switch it with move(), which is the P_M equivalent of Move() and is called for every tick that you're holding down the movement keys, which would make much better trails.
Also, best way to make a trail is to create a mob() that has no density and does nothing for the movement. Then, when you create it, go ahead and adjust its position to match the players mob with set_pos(px,py). Also, when you create that mob, you will want to use mob/path/new(loc) so that it's created at your current position, this saves some headaches I've run into before where the mob gets created at (0,0,0) and then set_pos() does nothing.