Spinning wheel "CUT THE ROPE"

Good Evening friends,

I am trying to make a “wheel” with the same action of the spinning wheel game CUT THE ROPE. Here is a sample image, you see the idea is when I click and rotate to one side with your finger in circular motion it performs an action when turning to the other side in the same circular motion rudder performs another action.

Can anyone give me an example or idea how to do? I’ve tried various ways and have not had good results.
Sample Image -> http://imageshack.us/photo/my-images/217/cuttherope.jpg/
thanks [import]uid: 23063 topic_id: 11874 reply_id: 311874[/import]

try this

note :- this is not fully optimized or tested code it is just for reference how to achieve that thing (it may have bug(s))

[lua]local physics = require “physics”
physics.start()
–physics.setDrawMode(“hybrid”)

local line1 = display.newRect(100,100,5,100)
local line2 = display.newRect(100,100,5,100)
line2.rotation = 90

local circle = display.newCircle(100,150,15)
physics.addBody(circle,“static”)
local lines = {}

local isReverse = 1
local function rotate()
if isReverse == 1 then

line1.rotation = line1.rotation + 5
line2.rotation = line2.rotation + 5
if #lines == 0 then
lines[#lines + 1] = display.newRect(0,0,1,3)
lines[#lines].x = circle.x + circle.width * 0.5
lines[#lines].y = circle.y
physics.addBody(lines[#lines],{density = 0.01})
else
lines[#lines + 1] = display.newRect(0,0,1,3)
lines[#lines].x = circle.x + circle.width * 0.5
lines[#lines].y = lines[#lines - 1].y + lines[#lines - 1].height
physics.addBody(lines[#lines],{density = 0.01})
end
if #lines == 1 then
myJoint = physics.newJoint( “pivot”, lines[#lines], circle, lines[#lines].x,lines[#lines].y )
else
myJoint = physics.newJoint( “pivot”, lines[#lines], lines[#lines - 1], lines[#lines].x,lines[#lines].y )
end
myJoint:setRotationLimits( -45, 45 )
else
line1.rotation = line1.rotation - 5
line2.rotation = line2.rotation - 5
lines[#lines]:removeSelf()
lines[#lines] = nil
end
end
timer.performWithDelay(70,rotate,0)

local function changeDirection()
isReverse = 1 - isReverse
end

local button = display.newText(“tap me to change direction”,200,0,native.systemFont,36)
button:addEventListener(“tap”,changeDirection)[/lua] [import]uid: 12482 topic_id: 11874 reply_id: 43367[/import]

Almost my friend,

note that in his example he must click on the “tap me to change direction” "to change the direction of the rudder, but what I need is to change the wheel rotation when I make a circular motion with my finger, you know ? I’ll click the wheel and make circular motion to the right and the rope will decrease or I’ll click with my finger and make circular motion to the left and the rope will increase, right? the action of the string is ok, just change the only part of how activates it, as described above.

Thanks [import]uid: 23063 topic_id: 11874 reply_id: 43425[/import]

@Dhennrich:-

yup i know which type of functionality is in the cut the rope that’s wonderful game and as i had said it is just for reference
now you have basic idea try to play with this basic idea and achieve what you want
:slight_smile: [import]uid: 12482 topic_id: 11874 reply_id: 43739[/import]