Hey there!
I have a code bit that allows me to drag an object along the screen with my finger but i want my object to only move in a circle instead of all over the screen. How do i do this?
Image for clarification in attachement
My code:
-- Define a circle object need to be move local circleObj = display.newCircle( 150, 150, 40 ) -- 150,150 =\> set the position 40 =\> radius of the circle circleObj:setFillColor(121,121,121) -- fill the circle with color circleObj.strokeWidth = 4 -- Sets the width of the border of circle circleObj:setStrokeColor(128,0,0) -- Sets the border color --Function that move the circle function moveCircle( event ) -- Set the cordinates of the circle circleObj .x, circleObj .y = event.x + 20, event.y return true end --Touch event that will fired when we will touch the screen circleObj:addEventListener("touch", moveCircle)
I feel like i am really close but i cant seem to figure it out.
Help me please!
Regards,