Lerp issue with 8 direction´s set angle <SOLVED>

0 favourites
  • 5 posts
From the Asset Store
Hand-animated Sprite Base for isometric game/animation development
  • I´m using 8 direction for my roguelike prototype, but i´m having an issue when another object follows player´s angle with a lerp.

    Im not sure if it´s really 8 direction´s fault but the thing is that when the player reaches 360 degrees (or 0 degrees whne turning left) it automatically sets its angle to 0 (as expected). The problem is that any object lerping to its angle will take the longest route, instead of just skipping one degree to the right. The lerp will go crazy, turning 360 degrees nonstop until all keys are released. This last part is the one that i´m not sure why it happens.

    In general i´m not very happy with how 8 dir controls feel, so if there is no better way to solve this than rebuilding the whole movement system without the behavior, no problem. By the way, I know I could use the pin behavior but I prefer smooth lerps for aiming.

    Thanks for the help

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm not 100% sure what your problem is, but have you tried anglelerp instead? It's the same thing but it accounts for going backwards to get to a higher number (eg 5 going to 355)

  • God damn genius. It worked! I didn´t even know anglelerp existed! Is there any other variant of lerp?

  • Theres an unlerp which is a reverse lerp (Ive never used it, im not entirely sure how or when it would be used) You can find all of the system expressions in the manual here.

  • Thanks a lot for everything!

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