# ROTATE behaviour

0 favourites
• 6 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
• Hi

I got a Wheel object and I am trying to apply ROTATE action. Wheel is rotating fine when I touch and drag. I am not able to find how to decrease the speed of wheel slowly and stop.

Could anyone please guide me for this problem?

Many Thanks

• Set the rotate behavior's acceleration to a negative value to make it slow down. And then disable it or set the speed to 0 when the speed is <= 0.

• Great Ramones, Thanks for your repsonse. It helped me. Now when I set to negative value then wheel is reducing its speed which is great and then started moving back.

I am trying for the event when wheel speed is <=0 to set the wheel rotate speed= 0 and acceleration =0 but no luck.

Could you please help me on which event I can set speed=0 and acceleration =0 for the wheel so that wheel will stop slowly?

Many Thanks

• Ramones, sorry for silly question. I got the solution now. Slowly getting used to this great tool.

Many Thanks.

• Hi Ramones and Friends,

Regarding the Wheel, when it stops then we would like to know who won based on the position of the wheel where it stopped. We have put a pointer at the top center of the wheel.

Please could you let me know how to handle and implement these kind of scenarios?

Many Thanks

• ## Try Construct 3

Develop games in your browser. Powerful, performant & highly capable.

Construct 3 users don't see these ads
• You can use the angle of the wheel to determine which value is at the top.

For a wheel with 4 segments you can take the angle / 90 and round it down to get a value 0, 1, 2, or 3.

``````floor(angle / 90)[/code:3slveguu]
[code:3slveguu]angle 0-90: floor(angle / 90) = 0
angle 90-180: floor(angle / 90) = 1
angle 180-270: floor(angle / 90) = 2
angle 270-360: floor(angle / 90) = 3[/code:3slveguu]

If you want the wheel to look like this:
[img="https://dl.dropboxusercontent.com/u/8367729/construct/sprites/wheel/wheel_4_segments.png"]
Then you need to add 45 degrees to the angle and use modulo 360 to prevent it going above 360.
[code:3slveguu]floor(((angle + 45) % 360) / 90)[/code:3slveguu]

Generalising that:
The value 90 is 360 / number of segments
The value 45 is 360 / number of segments / 2 [b]=[/b] 180 / number of segments

So the formula for a wheel with any number of segments is:
[code:3slveguu]floor(((angle + (180 / numSegments)) % 360) / (360 / numSegments))[/code:3slveguu]``````
• 6 posts