How do I rotate an object in clock and anticlockwise?

Get help using Construct 2

Post » Wed Aug 19, 2015 12:51 pm

Hi I have an object that should change directions
from clockwise to anticlockwise and viceversa on button left or right arrow down.
For that I wrote two events for button downs.
For clockwise
Image

and for anticlock wise, I just replaced sin by cos and cos by sin.

Now when changing directions the object is not starting from where it stopped. It is disappering from there and generating at a random point on the circumference. Can someone help me with this.?
Thanks.
B
8
S
1
Posts: 40
Reputation: 868

Post » Wed Aug 19, 2015 3:09 pm

every object already has an angle attribute. you could just, on every tick, set angle to object.angle + speed * dt to go clockwise, or object.angle - speed * dt to go anticlockwise. The angle will stay where it is when you change directions.
B
96
S
33
G
20
Posts: 438
Reputation: 17,665

Post » Fri Aug 21, 2015 6:06 am

@AllanR Thanks for your solution. I combined it with another one and got what I want. Its very helpful.
B
8
S
1
Posts: 40
Reputation: 868


Return to How do I....?

Who is online

Users browsing this forum: KTML5 and 24 guests