Here’s the code. Some of the images and stuff whoever’s looking at it won’t have, but if you replace the images, it should work.
Also includes part of the Director Class.
Side note, what this is is a wheel you spin, then on the outside of that wheel are other images that rotate around with it, that would show up in a box to the right. of the wheel. Mimics one of those old fashion wheels teachers use to use for grading if that makes any sense.
The wheel image is one image that has 5 sections to in in the image itself. Turn the wheel, lands on a particular segment, another image to the right of it shows up.
It’s not fully finished, but you get the main point here. Might be a bit sloppy, but it works.
Thanks again for your help.
module(…, package.seeall)
local director = require “director”
local physics = require( “physics” )
physics.start()
physics.setGravity( 1000, 1000 )
physics.setDrawMode( “normal” ) – normal, hybrid, debug
local centerX = display.contentCenterX
local centerY = display.contentCenterY
local localGroup
local makeButtons = function ()
–everything in here
----insert content windows–
local teenGospelscroll=display.newImage( “img/teen/teenGospelscroll.png” )
teenGospelscroll.x, teenGospelscroll.y=centerX, 0
teenGospelscroll.xScale, teenGospelscroll.yScale = .5,.5
localGroup:insert(teenGospelscroll)
local teenGodscroll=display.newImage( “img/teen/teenGodscroll.png” )
teenGodscroll.x, teenGodscroll.y= 70, -230
teenGodscroll.rotation = -72
teenGodscroll.xScale, teenGodscroll.yScale = .5,.5
localGroup:insert(teenGodscroll)
local teenCrossscroll=display.newImage( “img/teen/teenCrossscroll.png” )
teenCrossscroll.x, teenCrossscroll.y= -200, -150
teenCrossscroll.rotation = -144
teenCrossscroll.xScale, teenCrossscroll.yScale = .5,.5
localGroup:insert(teenCrossscroll)
local teenManscroll=display.newImage( “img/teen/teenManscroll.png” )
teenManscroll.x, teenManscroll.y= 100, 250
teenManscroll.rotation = -216
teenManscroll.xScale, teenManscroll.yScale = .5,.5
localGroup:insert(teenManscroll)
local teenTrustscroll=display.newImage( “img/teen/teenTrustscroll.png” )
teenTrustscroll.x, teenTrustscroll.y= 100, 250
teenTrustscroll.rotation = -288
teenTrustscroll.xScale, teenTrustscroll.yScale = .5,.5
localGroup:insert(teenTrustscroll)
–insert BackGround–
local teenBG=display.newImage( “img/teen/teenBG.png” )
teenBG.x, teenBG.y=centerX, centerY
teenBG.xScale, teenBG.yScale = 1,1
localGroup:insert(teenBG)
–[[
local wheel= display.newGroup()
wheel.xReference, wheel.yReference = 240, 160
–WHEEL–
local teenCross=display.newImage( “img/teen/teenCross.png” )
teenCross.x, teenCross.y=centerX, centerY
teenCross.xScale, teenCross.yScale = .5,.5
local teenGod=display.newImage( “img/teen/teenGod.png” )
teenGod.x, teenGod.y=centerX, centerY
teenGod.xScale, teenGod.yScale = .5,.5
local teenGospel=display.newImage( “img/teen/teenGospel.png” )
teenGospel.x, teenGospel.y=centerX, centerY
teenGospel.xScale, teenGospel.yScale = .5,.5
local teenMan=display.newImage( “img/teen/teenMan.png” )
teenMan.x, teenMan.y=centerX, centerY
teenMan.xScale, teenMan.yScale = .5,.5
local teenTrust=display.newImage( “img/teen/teenTrust.png” )
teenTrust.x, teenTrust.y=centerX, centerY
teenTrust.xScale, teenTrust.yScale = .5,.5
wheel:insert(teenCross)
wheel:insert(teenGod)
wheel:insert(teenGospel)
wheel:insert(teenMan)
wheel:insert(teenTrust)
localGroup:insert(wheel)
wheel.x = 140
]]
local dialcontainer = display.newGroup()
–dialcontainer.x, dialcontainer.y = -100, 0
dialcontainer.pivot = display.newCircle( dialcontainer, display.contentCenterX, display.contentCenterY, 10 )
dialcontainer.pivot:setFillColor( 0, 255, 100, 0 )
local dial = display.newGroup()
dialcontainer:insert( dial )
–dial:insert(wheel)
dial.x, dial.y = display.contentCenterX, display.contentCenterY
dial.wheel = display.newImage( dial, “img/teen/TeenWheel2.png” )
dial.wheel.x, dial.wheel.y=0, 0
dial.wheel.xScale, dial.wheel.yScale = .5,.5
dial:insert(teenGospelscroll)
dial:insert(teenGodscroll)
dial:insert(teenCrossscroll)
dial:insert(teenManscroll)
dial:insert(teenTrustscroll)
–add image content to here somewhere. Use “dial”
–display.newCircle( dial, 0, 0, 110 )
–dial.wheel:setFillColor( 0, 255, 100, 155 )
–[[
dial.dot =
–display.newImage( dial, “img/teen/teenPointer.png” )
display.newCircle( dial, 0, 105, 5 )
dial.dot:setFillColor( 0, 0, 0, 255 )
]]
physics.addBody( dialcontainer.pivot, “static”, { friction=1000000, density=1000000, bounce=1000 } )
physics.addBody( dial, “dynamic”, { friction=1000000, density=1000000, bounce=1000, radius=100 } )
dialcontainer.pivotjoint = physics.newJoint( “pivot”, dialcontainer.pivot, dial, display.contentCenterX, display.contentCenterY )
function dragBody( event )
local body = event.target
local phase = event.phase
local stage = display.getCurrentStage()
if “began” == phase then
stage:setFocus( body, event.id )
body.isFocus = true
– Create a temporary touch joint and store it in the object for later reference
body.tempJoint = physics.newJoint( “touch”, body, event.x, event.y )
elseif body.isFocus then
if “moved” == phase then
– Update the joint to track the touch
body.tempJoint:setTarget( event.x, event.y )
elseif “ended” == phase or “cancelled” == phase then
stage:setFocus( body, nil )
body.isFocus = false
– Remove the joint when the touch ends
body.tempJoint:removeSelf()
end
end
– stop further propagation of touch event
return true
end
function moveBody( event )
if (event.numTaps == 1) then
–dialcontainer.pivot.x, dialcontainer.pivot.y = event.x, event.y
dragBody( { phase=“began”, target=dial } )
dragBody( { phase=“ended”, target=dial } )
return true
end
end
dial:addEventListener( “touch”, dragBody )
–Runtime:addEventListener( “tap”, moveBody )
localGroup:insert(dialcontainer)
dialcontainer.pivot.x, dialcontainer.pivot.y = 140,centerY
local teenPointer=display.newImage( “img/teen/teenPointer.png” )
teenPointer.x, teenPointer.y=centerX-100, centerY
teenPointer.xScale, teenPointer.yScale = .5,.5
localGroup:insert(teenPointer)
return localGroup
end
new = function()
localGroup = display.newGroup()
makeButtons()
return localGroup
end [import]uid: 11144 topic_id: 5373 reply_id: 18834[/import]