How do I "smooth" rotate an object with the mouse

Get help using Construct 2

Post » Wed Jul 30, 2014 7:05 pm

Hello !

I'd like to create a game such as Reus.

Image

I have one circle sprite (for the earth) and i would like it to "smooth" rotate with my mouse. Such as if there was a touch scroll all around the earth which would make it rotate around its own center.

Do you have any idea how to do that ?

Thank you,
Thomeuxe
B
4
Posts: 4
Reputation: 212

Post » Wed Jul 30, 2014 7:38 pm

I'm thinking of using the Physics Behavior and using torques and angular velocity but how can I get the swipe movement of the mouse ?
B
4
Posts: 4
Reputation: 212

Post » Wed Jul 30, 2014 7:45 pm

So you want to touch screen - touch anywhere, and while you touching and moving your finger circle should rotate? But rotate only when you are moving your finger.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Wed Jul 30, 2014 8:06 pm

That's it.
I'd like to do it smooth : when you release the touch, the rotation slows down to 0.

So when you touch and move your mouse/finger in any direction, the circle rotate in this direction and you release your mouse/touch, the rotation stops. And you touch again at the same place to continue the rotation (such as android/iphone touch scroll)
B
4
Posts: 4
Reputation: 212

Post » Wed Jul 30, 2014 8:25 pm

Something like this?
You do not have the required permissions to view the files attached to this post.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343

Post » Thu Jul 31, 2014 8:52 am

I've finally done it, thanks to your help for the scroll (I wanted to enable a 360° scroll).
I used the behavior rotation combined with Touch.SpeedAt to continue the rotation after the user releases the touch (and a positive/negative acceleration depending on wich side it's turning to make it stop).

Here is my .capx for those who might have the same question :
TurnPlanetV2.capx


Thank you Shinkan :)
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 4
Reputation: 212

Post » Thu Jul 31, 2014 12:27 pm

ahh, I misunderstood your question a bit.
But I'm glad you were able to solved it yourself.
ImageImageImageImage
B
157
S
66
G
42
Posts: 2,603
Reputation: 35,343


Return to How do I....?

Who is online

Users browsing this forum: boybacteria, Microbex, Phacanu, richcoz81 and 29 guests