Smooth rotation

Get help using Construct 2

Post » Fri Jan 20, 2012 4:29 am

Hi,

I'm new to construct and just finish the ghost hunter tutorial.

I noticed in the game that monster>set angle toward player .X & .Y makes the monster to flip suddenly & not rotate to the player's position, not like the player>set angle toward mouse that follow the cursor 360 smoothly.

How do i make the monster turn smoothly & maybe can edit their turning speed, etc?

Thank you
B
3
Posts: 3
Reputation: 281

Post » Fri Jan 20, 2012 5:23 am

I made a small example to show you how smooth rotation can be done:

http://db.tt/dJ3uUEcg

It's a little bit more complicated than it should be thanks to the way angles work, and there's a problem with it, which you'll notice quickly: under certain conditions, the arrow will rotate in the opposite direction to get to the mouse, but I don't know enough about the angles system to work around that. Maybe someone else can take a look at that?

Anyways, you can edit the "Arrow | Set angle to Arrow.Angle +/- 1" event to change the turning speed. Changing 1 to 5 for example will be a lot faster.
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Fri Jan 20, 2012 5:48 am

[QUOTE=SullyTheStrange]under certain conditions, the arrow will rotate in the opposite direction to get to the mouse, but I don't know enough about the angles system to work around that. Maybe someone else can take a look at that?[/QUOTE]
Oooh man I've seen a fix to that before, I just can't remember what it was, but it was pretty damn simple7Soul2012-01-20 05:48:17
B
83
S
21
G
15
Posts: 1,039
Reputation: 15,134

Post » Fri Jan 20, 2012 6:29 am

New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Fri Jan 20, 2012 7:14 am

Thanks, i'll try & see if i can fix it.
But the stuff posted abit too advance for me :D
B
3
Posts: 3
Reputation: 281

Post » Fri Jan 20, 2012 9:47 am

All you need to do is use the 'rotate toward...' actions instead of 'set angle'.
Scirra Founder
B
359
S
214
G
72
Posts: 22,946
Reputation: 178,468

Post » Fri Jan 20, 2012 6:43 pm

[QUOTE=Ashley] All you need to do is use the 'rotate toward...' actions instead of 'set angle'.[/QUOTE]

Wow... I never saw that.

Good thing I never had to use this in an actual game or I'd be pretty mad at myself!
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Sat Jan 21, 2012 2:10 am

Thank you, "rotate toward..." works fine :D
B
3
Posts: 3
Reputation: 281


Return to How do I....?

Who is online

Users browsing this forum: CavalierBubble, imnotspecial and 22 guests