# How do I Rotate an object based on touch position,(turntable

Get help using Construct 2

### » Sun Feb 08, 2015 8:49 pm

I would like to do something like a Turntable, where based on the touch position, you can spin forward backward the object. I don't think sound could be done like this as well could it? something like "DJ scratches"?
B
14
S
3
G
4
Posts: 61
Reputation: 3,529

### » Sun Feb 08, 2015 10:35 pm

On touch set initx, inity variables to touch xy, set isintouch variable to 1
variable isintouch=1, set mydist variable to distance(initx,inity,touch.x,touch.y)
->initx>touch.x, do foo
->initx<touch.y, do pitydafoo
B
173
S
50
G
194
Posts: 8,567
Reputation: 121,370

### » Fri Feb 27, 2015 6:44 am

Can you please explain this code neatly .I'm not able to understand it properly beacuse im new to construct 2.

On touch set initx, inity variables to touch xy, set isintouch variable to 1
variable isintouch=1, set mydist variable to distance(initx,inity,touch.x,touch.y)
->initx>touch.x, do foo
->initx<touch.y, do pitydafoo

I want to rotate the wheels by touch .If i move my finger clockwise then wheels should rotate clockwise and if i move my finger anticlockwise then it should move anticlockwise direction.

Can you please put .capx file or put code of rotation of wheels by touch gesture .
B
3
Posts: 7
Reputation: 195

### » Mon Mar 16, 2015 11:28 am

I got the solution. We can do it by the event -> wheel , followed by the action -----> set angle towards(Touch.X,Touch.Y)
B
3
Posts: 7
Reputation: 195

Return to How do I....?

### Who is online

Users browsing this forum: vecto0r and 14 guests