ROTATE behaviour

Discussion and feedback on Construct 2

Post » Sat Jun 14, 2014 7:15 pm

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
B
4
Posts: 7
Reputation: 214

Post » Sat Jun 14, 2014 9:03 pm

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.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680

Post » Sun Jun 15, 2014 9:41 am

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
B
4
Posts: 7
Reputation: 214

Post » Sun Jun 15, 2014 10:15 am

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

Many Thanks.
B
4
Posts: 7
Reputation: 214

Post » Sun Jun 15, 2014 10:43 am

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
B
4
Posts: 7
Reputation: 214

Post » Sun Jun 15, 2014 1:41 pm

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.
Image
Code: Select all
floor(angle / 90)

Code: Select all
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


If you want the wheel to look like this:
Image
Then you need to add 45 degrees to the angle and use modulo 360 to prevent it going above 360.
Code: Select all
floor(((angle + 45) % 360) / 90)


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

So the formula for a wheel with any number of segments is:
Code: Select all
floor(((angle + (180 / numSegments)) % 360) / (360 / numSegments))
You do not have the required permissions to view the files attached to this post.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,680


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 2 guests