duplicating or copying an actor

Hi,
I hope you guys can help me with this problem:
I am making a scene in which you have to pick up an item(actor) and drag it to a different spot. However, I don't want the original actor to disappear when it is being dragged to a different place, I want to copy the actor so the original actor stays in place. This way the user can grab as many items as he likes, as if there is an endless pile of them.
First I tried to do exactly that: I placed a huge number of actors on top of each other. This didn't work as they then all behaved as one actor.
I then tried the 'replicate' behavior, which didn't work either.
What seemed to work is the 'spawn' behavior. I gave my actor this rule:
When actor receives event touch is pressed
constrain attribute
spawn actor
layer order in back of actor (I tried different orders here)
direction 0 relative to actor (as I do not want the spawned actor to appear in a different location as the original actor)
position 0 relative to actor (same reason)
This seems to work as a new actor is created when you touch the item and drag it. However, the new actor doesn't appear in the exact spot as the former actor. It seems to just jump to a place, without any logic. Sometimes it appears a few millimeters higher, sometimes a bit to the right, but never in the exact same spot as where the old actor was.
As I am starting to get a bit desperate, I hope someone can help me out!
Thanks,
Maaike
I hope you guys can help me with this problem:
I am making a scene in which you have to pick up an item(actor) and drag it to a different spot. However, I don't want the original actor to disappear when it is being dragged to a different place, I want to copy the actor so the original actor stays in place. This way the user can grab as many items as he likes, as if there is an endless pile of them.
First I tried to do exactly that: I placed a huge number of actors on top of each other. This didn't work as they then all behaved as one actor.
I then tried the 'replicate' behavior, which didn't work either.
What seemed to work is the 'spawn' behavior. I gave my actor this rule:
When actor receives event touch is pressed
constrain attribute
spawn actor
layer order in back of actor (I tried different orders here)
direction 0 relative to actor (as I do not want the spawned actor to appear in a different location as the original actor)
position 0 relative to actor (same reason)
This seems to work as a new actor is created when you touch the item and drag it. However, the new actor doesn't appear in the exact spot as the former actor. It seems to just jump to a place, without any logic. Sometimes it appears a few millimeters higher, sometimes a bit to the right, but never in the exact same spot as where the old actor was.
As I am starting to get a bit desperate, I hope someone can help me out!
Thanks,
Maaike
Answers
Maaike