local function draggable(event) local target = event.target if event.phase == "began" then target.markX = target.x -- store x location of object target.markY = target.y -- store y location of object elseif event.phase == "moved" then local x = (event.x - event.xStart) + target.markX local y = (event.y - event.yStart) + target.markY target.x, target.y = x, y -- move object based on calculations above end return true end object:addEventListener("touch",draggable)
It loses the target if you move too fast and it interferes with other objects with this event is attached to.