Hello everyone,
Please take a look at my code:
local r = 300 local numPoints = 10 local xCenter = display.contentCenterX local yCenter = display.contentCenterY local angleStep = 2 \* math.pi / numPoints local group = display.newGroup() local circle = {} for i = 1, numPoints do circle[i] = display.newCircle(0, 0, 20) circle[i].x = xCenter + r\*math.cos(i\*angleStep) circle[i].y = yCenter + r\*math.sin(i\*angleStep) group:insert( circle[i] ) end local function onUpdate( event ) for i = 1, numPoints do t = (event.y \* .014)+ (i\*angleStep) circle[i].x = xCenter+(r \* math.cos(t)) circle[i].y = yCenter+(r \* math.sin(t)) end end Runtime:addEventListener( "touch", onUpdate )
I have 2 question:
- I want to touch everywhere on the screen,drag or swipe in any direction to rotate those objects. My code is only work with “event.y” or “event.x” and can not “swipe”.
2.Still touch everywhere on the screen, drag or swipe (or at least “touch”) to move those objects to the center of the screen “one after another”. I can make them move but they just move all at the same time.
Help is much appreciated :)