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

  • Hi everyone.

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

    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?

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Thanks - in Construct 3 I only see No, Smooth, 90* and 45*

  • Sprite set angle

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

    This can smoothly rotate towards a desired angle.

  • Thank you.

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

    That doesn't seem to work in combination with the 8 direction behavior?

  • 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

  • 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 :/

  • 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.

  • Same in both: Sprite.8Direction.MovingAngle.

  • 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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)