ID:142883
 
Code:
obj
test
icon = 'test.dmi'
icon_state = ""
density = 1
Move()
var/obj/a=new/obj/test1(src.loc)
a.dir=src.dir
a.Owner=src
spawn(30)
del(a)
..()


obj
test1
icon = 'test.dmi'
icon_state = "trail"
density = 1


Problem description:well when i move the icon it always pops up on the head of the trail. How would i prevent this.

well first

obj
test1
icon = test.dmi'// change this to icon = 'test.dmi'
icon_state = "trail"
density = 1
In response to Nategrant
ok.... Now what...
If I understand you, you want the trail to spawn behind the head, and not on top of it.

Your problem lies in the Move() proc of /obj/test. In the new() proc, you're explicitly telling the tail object to spawn at src.loc, which is on top of the head object. Use locate() instead of src.loc to add or subtract one from src.x or src.y.
In response to Mobius Evalon
Yea, thats excalty what I was tring to do. Thanks for tip but wouldn't i have to do it fore every dir?
In response to Trane5
Indeed, you would. To make the tail follow the head as you're looking for, you'd have to make an if statement for all eight dirs:

var ecks,why = 0
switch(src.dir)
if(1) why = -1
if(2) why = 1
if(4) ecks = -1
if(5)
ecks = -1
why = -1
if(6)
ecks = -1
why = 1
if(8) ecks = 1
if(9)
ecks = 1
why = -1
if(10)
ecks = 1
why = 1


And using that little snippet, you can add ecks and why to src.x and src.y to determine where the tail must go.
In response to Mobius Evalon
Don't i have to put this in the obj? Also is there a simpler way to to the code you provided? I have no idea what you mean can you explain?
In response to Mobius Evalon
What? No! That's not even CLOSE to right! In fact, what was in the original post should be completely correct and the problem description makes no sense.

[edit] Oh, right: ..() should be changed to .=..() Otherwise it's good.
In response to Trane5
Yes, you would put this code in the head object Move() proc, before the creation of the tail object. And I believe the code snippet I provided is about as simple as it gets.
In response to Mobius Evalon
ok i narrowed it down and it worked thanks a lot. But it has these warnings
Also is this the only thing im suppuse to addd the code snippet?Cause every time i move it goes on the head then back behind.
13:ecks :warning: variable defined but not used
13:why :warning: variable defined but not used
In response to Mobius Evalon
Well, you don't have to.

mob
var/mob
follower

verb/summon_follower()
if(!follower) follower = new/mob(loc)
else follower.summon_follower()

Move(newLoc,newDir)
var/oldLoc = loc
. = ..()
if(follower && oldLoc != newLoc)
follower.Move(oldLoc)


The follower always stays behind his leader. It works for multiple followers, too.
In response to Trane5
Also i had another problem with this i got souteast icon but when i got to south then turn east it doesnt show one of the multiple directions show>>??