Drag Me sample code

Is there a way to send back the image to its original position when event.phase ==“ended” is called.Basically I want my image to go back to its original position from where i started the phase ==“began” for draging.
Please help me out doing this as I am unable to figure it out. [import]uid: 82446 topic_id: 18408 reply_id: 318408[/import]

Not sure if I’m thinking about the same code as you, but the drag me example I remember was storing the original coordinates of the object at the phase == “began” stage as p.x0 and p.y0. So if you wanted the object to snap back to its original location, you would use:

if phase == "ended" then p.x = p.x0 p.y = p.y0 [import]uid: 41884 topic_id: 18408 reply_id: 70617[/import]

that worked …Awesome.Can i give name to all the three images so that when i touch it i can do whatever i want…Or is there any other way to do that? [import]uid: 82446 topic_id: 18408 reply_id: 70782[/import]

Uh, well I haven’t looked at the source in awhile, but you can easily add extra if statements in the event, so like

if phase == "ended" then  
if event.target == "box1" then  
--do this  
elseif event.target == "box2" then  
--do that  
--etc  

Sorry for the late reply but hard to tell what you were asking for :slight_smile: [import]uid: 41884 topic_id: 18408 reply_id: 71605[/import]