can anyone give me an insight of how to create a function that is :
-able to move an object freely, following the touch source
so that for an example, i have a ball object. whenever my finger touch the screen, and haven’t let go, the ball will be dragged around the screen.
Here’s what I have done so far
local function backgroundTouch(event) if (event.phase=="ended" and movingScreen==true) then local delta = event.xStart - event.x print('ended') if (delta \< -10 and animalPage \> 0) then movingScreen=false animalPage = animalPage - 1 transition.to(animalGroup,{time=300, x=animalPage\*-800}) end if (delta \> 10 and animalPage\<totalAnimals) then movingScreen=false animalPage = animalPage + 1 transition.to(animalGroup,{time=300, x=animalPage\*-800}) end end if (event.phase=="moved" and movingScreen==false) then local delta = event.xStart - event.x print('moving') if (delta \< -10 and animalPage \> 0) then movingScreen=true --animalPage = animalPage - 1 transition.to(animalGroup,{time=300, x=-event.xStart}) end if (delta \> 10 and animalPage\<totalAnimals) then movingScreen=true --animalPage = animalPage + 1 transition.to(animalGroup,{time=300, x=-event.xStart}) end end return true end