I am trying to create a simple app in codea on my ipad that displays an image and lets the user move it.I am able to display the image properly,but am not able to move it with my finger.
Here is my code for it.
function touched(touch)
local currentTouchPosition = vec2(touch.x,touch.y)
if (touch.state == BEGAN) then
end
if (touch.state == MOVING) then
if ((imagePosition.x - imageSize.x/2) < currentTouchPosition.x and
(imagePosition.x + imageSize.x/2) > currentTouchPosition.x and
(imagePosition.y - imageSize.y/2) < currentTouchPosition.y and
(imagePosition.y + imageSize.y/2) > currentTouchPosition.y ) then
imagePosition = currentTouchPosition
end
end
if (touch.state == ENDED) then
end
end
How should I make it work?...Thanks in advance.