Hello, I am trying to work on how to make a spin wheel, like the one on http://wheeldecide.com that is changeable and works functionally. I have tried multiple different methods and scripts to try to give off the desired payoff.
local spin = display.newImage ("spinwheel3.jpg") spin.x = 315 spin.y = 575 local adjustment = 0 local spinWheel = display.newImageRect( "wheel.png", 250, 250 ) wheel.x, wheel.y = display.contentCenterX, display.contentCenterY local function onTouch(event) display.getCurrentStage():setFocus( event.target ) if(event.phase == "began") then local dx = event.x - (spinWheel.x) local dy = event.y - (spinWheel.y) adjustment = math.atan2(dy,dx) \* 180 / math.pi - spinWheel.rotation elseif(event.phase == "moved") then local dx = event.x - spinWheel.x local dy = event.y - spinWheel.y wheel.rotation = (math.atan2(dy,dx) \* 180 / math.pi) - adjustment end end wheel:addEventListener('touch', onTouch)
Nothing has really worked except adding a background. I have tried for a long time, and this will be my first app. Can anyone provide any help?