Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local wheel = display.newGroup()
- wheel.x, wheel.y = display.contentCenterX, display.contentCenterY
- display.newRect(wheel, 50, 0, 10, 10)
- display.newCircle(wheel, 0, 0, 5)
- function wheel:touch(event)
- local x, y = self:contentToLocal(event.x, event.y)
- if event.phase == 'moved' then
- self.rotation = self.rotation + math.deg(math.atan2(y, x))
- for i= 1, self.numChildren do
- self[i].rotation = -self.rotation
- end
- end
- end
- Runtime:addEventListener('touch', wheel)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement