[SMOOTH SPRITE ROTATION] 8-Direction Top Down Sprite?

Just started using Construct 2? Post your questions here

Post » Sat May 27, 2017 8:00 am

Hi everyone.

I'm using the following image as a moving sprite with 8-Direction behavior.

Image

Problem:

When I hit the up/down/left/right arrow keys, the sprite flips towards the selected direction/arrow keys.

How can I get the sprite to rotate smoothly towards the selected arrow keys with 8-direction behavior enabled?

I've tried "System On Key Press" > "Rotate Sprite Towards" but I can't get it to work :/

If the object is at 90 and I press the left arrow key to set it at 270 (etc...), how can I get the rotation to occur smoothly instead of it flipping towards 270?
B
4
S
1
Posts: 6
Reputation: 312

Post » Sun May 28, 2017 3:54 pm

You can use set angle in the 8-direction behavior settings to set the rotaion speed, if its set to 360 it will rotate instantly.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,357

Post » Sun May 28, 2017 8:23 pm

Thanks - in Construct 3 I only see No, Smooth, 90* and 45*
B
4
S
1
Posts: 6
Reputation: 312

Post » Sun May 28, 2017 8:26 pm

Sprite set angle
To Anglelerp(sprite.angle,desired_angle,50*dt)

This can smoothly rotate towards a desired angle.
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Sun May 28, 2017 9:27 pm

Thank you.

Image

I've tried various angles and time combos...

That doesn't seem to work in combination with the 8 direction behavior?
B
4
S
1
Posts: 6
Reputation: 312

Post » Sun May 28, 2017 10:44 pm

Looks like your anglelerping towards angle 0 there, try setting that to anglelerp(sprite.angle , sprite.8direction.angleofmovement, 50*dt)

Also, disable setting the angle in the 8direction behavior for the anglelerp to work
Who dares wins
B
57
S
17
G
21
Posts: 1,878
Reputation: 19,552

Post » Mon May 29, 2017 3:08 am

Thank you,

I've tried disabling setangle in the 8 direction behavior panel, and added anglelerp(sprite.angle , sprite.8direction.angleofmovement, 50*dt)

angleofmovement doesn't seem to be a valid entry, so I tried replacing it with MovingAngle, but still no luck :/
B
4
S
1
Posts: 6
Reputation: 312

Post » Mon May 29, 2017 11:44 am

The example I showed you was in construct 2, I guess in construct 3 is different. You posted the topic in the construct 2 side of the forum so I thought we ware talking about construct 2 sorry.
Like my work? Fallow me on social media, and see my games on the arcade.
B
7
S
5
G
9
Posts: 298
Reputation: 5,357

Post » Mon May 29, 2017 1:07 pm

Same in both: Sprite.8Direction.MovingAngle.
B
33
S
18
G
27
Posts: 2,435
Reputation: 20,334

Post » Tue May 30, 2017 3:46 am

imhotep22 wrote:The example I showed you was in construct 2, I guess in construct 3 is different. You posted the topic in the construct 2 side of the forum so I thought we ware talking about construct 2 sorry.


My fault actually. I posted here since there seems to be more activity.

Thank you though.
B
4
S
1
Posts: 6
Reputation: 312


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 2 guests