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

Get help using Construct 2

Post » Tue Jul 21, 2015 9:45 am

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.
Image
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
Last edited by CloveltOc on Wed Jul 22, 2015 9:26 am, edited 1 time in total.
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Tue Jul 21, 2015 1:45 pm

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)
B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Tue Jul 21, 2015 2:20 pm

God damn genius. It worked! I didn´t even know anglelerp existed! Is there any other variant of lerp?
B
9
S
3
Posts: 153
Reputation: 1,272

Post » Wed Jul 22, 2015 5:12 am

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.
B
47
S
14
G
7
Posts: 603
Reputation: 8,141

Post » Wed Jul 22, 2015 9:27 am

Thanks a lot for everything!
B
9
S
3
Posts: 153
Reputation: 1,272


Return to How do I....?

Who is online

Users browsing this forum: worm1, Yahoo [Bot] and 21 guests