How do I rotate an object with smooth animation?

Get help using Construct 2

Post » Thu Nov 27, 2014 1:11 pm

Hi,

This is my first question and first post overall.

I'm trying to rotate an object with its own pivot point at the bottom. The image file has the object on the uppermost part of the canvas (around 15%, like a banner ad) with the rest as empty. I made it this way so it's easier to rotate.

When I use an action Rotate Counter-Clockwise 90 degrees, it works fine. But what I wanted to add is a smooth animation of the rotation taking place, with the speed of the rotation being modifiable. Is this possible? How do I do it?

Thanks for any replies in advance! :)
B
10
S
2
Posts: 25
Reputation: 719

Post » Thu Nov 27, 2014 1:13 pm

I forgot to mention, the object should only rotate when I press the left or right arrow keys, for counter-clockwise and clockwise directions respectively. I've already done that and that works fine too.
B
10
S
2
Posts: 25
Reputation: 719

Post » Fri Nov 28, 2014 1:04 am

I'm also struggling with this. I could very well be wrong but this is my understanding on how it's done:
I believe you want to use the "Rotate towards angle" action.
You need to have a trigger that is constant until your object has reached the desired angle. In other words, this way the action is looping every tick until it you get to the desired angle.
The "Degrees" parameter is how many degrees it'll rotate each tick and the "Angle" parameter is the desired angle.
As a side note you'll probably want to use the delta time expression with the "Degrees" parameter so that the speed isn't linked to the frame rate.

This does seem a bit long winded to me which makes me think I've got it wrong. If anyone has a better method I'd be interested also.
B
4
Posts: 8
Reputation: 221

Post » Fri Nov 28, 2014 2:27 am

@Mikerbice
@g3xas


this is how you do it manually wihtout plugins, i must admit that i struggle with it for half hour XDD
becuase i use some plugins to do it more easy, in case you want to use them, here :)

(rex rotate to behaviour)
http://c2rexplugins.weebly.com/rex_rotateto.html


there is more ways, this is a very basic one.
You do not have the required permissions to view the files attached to this post.
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Fri Nov 28, 2014 3:06 am

Thanks, Lunatrap.
Your attached capx is almost exactly how I've been doing it with instance variables, so that gives me confidence my thought process. Thank you also for the link to the plugin. I will have to check that out.
B
4
Posts: 8
Reputation: 221

Post » Fri Nov 28, 2014 4:43 am

@Mikerbice

you are welcome :)
B
23
S
6
G
3
Posts: 316
Reputation: 3,461

Post » Fri Nov 28, 2014 6:19 am

Thanks @Lunatrap and @Mikerbice for the replies. I'll check out the solution you posted @Lunatrap! :)
B
10
S
2
Posts: 25
Reputation: 719


Return to How do I....?

Who is online

Users browsing this forum: Semoreh and 7 guests