D&D question

Hi all,

I try to create a game with drag and drop. I wonder if it is possible to have an object that is a 'drag item' and 'drop target' at the same time. The situation is the following: I have picture 1 and picture 2. I drop picture 1 on top of picture 2 and picture 2 moves to a certain direction. This works fine if picture 1 is 'drag item' and picture 2 is 'drop target'. The problem is that I also want to be able to drag and drop picture 2 on top of picture 1 (and picture 1 to move in a certain direction). Has anyone done something similar? Are there any suggestions?

Many thanks,

Vassiliki

4 Replies
Vassiliki Bouki

Dear Emily,

Many thanks for the clarification - it is very useful. I wonder if you could elaborate a bit more about the technique you suggest (to duplicate objects on top of one another) or if you could redirect me to an example / tutorial. I have tried it but I cannot make it work.

Many thanks,

Vassiliki

Emily Ruby

Hi Vassiliki!

I am not sure your exact set up or if this would even work, but you could try to have duplicate shapes on top of one another, when the first one is dragged, the drop target moves in the direction it needs, and the drag item is hidden, then the duplicate item is available to be dragged back to the duplicate of the first item.

This "might' only work if they need to be dragged in one order, as they would need to be on top of each other in the timeline. I don't know if it  is a possibility, but hoping other members will join in with ideas or possible examples they may have.