so i have a image and on press i can move it around and what i want is for onRelease i want the image to go back to its original x and y axis. thanks
Store the original x and y coordinates in separate variables when you touch the image.
For example…
local moveImage = function(event)
if event.phase == “began” then
originX = image.x
originY = image.y
– move the image
end
if event.phase == “ended” then
transition.to(image, {time=250, x=originX, y=originY} )
end
end
image:addEventListener(“touch”,moveImage)
oh thanks!! i accualy tried
MyButton.x = display.contentWidth * 0.5
MyButton.y = 400
in the ended phase
and i worked! but your code is a ton better haha thanks again!
Store the original x and y coordinates in separate variables when you touch the image.
For example…
local moveImage = function(event)
if event.phase == “began” then
originX = image.x
originY = image.y
– move the image
end
if event.phase == “ended” then
transition.to(image, {time=250, x=originX, y=originY} )
end
end
image:addEventListener(“touch”,moveImage)
oh thanks!! i accualy tried
MyButton.x = display.contentWidth * 0.5
MyButton.y = 400
in the ended phase
and i worked! but your code is a ton better haha thanks again!