I am trying ton limit a drag with this code
--limit drag
local function limit()
local x = drwrGroup.x
local y = drwrGroup.y
if(x > 458) then
drwrGroup.x = 458
elseif(x < 0) then
drwrGroup.x = 0
end
drwrGroup.y = 0
end
Runtime:addEventListener(“enterFrame”, limit)
end
The problem is if the users drag is on an angle the object gets stuck. How can I limit the drag and allow for some angle?