Rotate towards angle in specific direction

0 favourites
  • 8 posts
From the Asset Store
Simple resize and rotate events for any sprite, quick and easy event sheet that you can use for your own projects.
  • Hi there,

    Just wondering if there's a simple way to use the 'rotate towards angle" action, but restrict it to a specific direction, eg. clockwise.

    Thanks in advance

  • If you input possitive value, it will rotate clockwise

    • Sprite rotate 2 degrees toward 60 (will rotate the sprite clockwise by 2 degrees toward angle 60?)

    Negative, counter-clockwise

    • Sprite rotate -2 degrees toward 60 (will rotate the sprite counter-clockwise by 2 degrees toward angle 60?)
  • Thanks for the reply.

    This seems to cause problems for me. It's like it's choosing the direction based on the shortest distance.

    I'm rotating towards 0?

    I've basically got it set up so if the object is moving left, and it jumps, it will rotate counter-clockwise. Then I'm using the "rotate towards angle" when it's falling to straighten it out. And likewise for when it's moving right.

    On the odd occasion it rotates the opposite way when it's falling, though most of the time, it's going the correct way. This is just by setting the "rotate towards angle" degrees to 10.

    Really I'm just trying to get rid of those odd times when it's wrong.

  • Can you upload the .capx or reproduce that part in a new one?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • http://dl.dropbox.com/u/12109568/Test.capx

    Arrows to move, ctrl to jump (you can jump multiple times)

    Thanks

  • I haven't seen the problem, but I tried this. Check it out if it's ok, should be always rotating correctly.

    edit> I just changed it a bit. Now you can't change the direction of rotation until the sprite made one full rotation.

    download

  • Ah nice, thanks heaps Noga.

    Much appreciated!

  • Thanks for this Noga. I was struggling to figure out how to set it so that it would rotate in the direction that the player is moving in - even though in my head I knew the logic. Much appreciated.

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