0 votes

I'm making a 2D platformer. I move the player, a KinematicBody2D, using moveandslidewithsnap(). The player accelerates, instead of instantly moving at max speed, done using linear interpolation:

(velocity.x = lerp(velocity.x, dir * speed, acceleration)

Currently, when the player stands on a slope, they slide down, and when falling onto a slope they get a lot of horizontal speed, which is not what I want.
I have tried everything I can think of. stoponslope is set to true, I have tried setting the snap to some ridiculous amount, I have tried setting the maxfloorangle to different values, I have spent hours browsing the internet and looking at demos, but I found nothing.
The only answers I've found didn't really work for me, because they only work in situations where the movement doesn't have any acceleration, like in the Platformer2D demo (https://godotengine.org/asset-library/asset/120)
So my question is: Is there a way to solve this problem?

in Engine by (22 points)

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.