Your ACCELERATION
is negative (odd?).
So when you go left:
motion.x = min(motion.x+ACCELERATION, MAX_SPEED)
Will actually subtract to motion.x
, and will always be lower than MAX_SPEED
... in the negatives.
Your code also doesn't check for all potential cases of overshooting MAX_SPEED
. Indeed, gravity can make you fall faster.
Maybe you could remove all caps from your current code and do them once just before calling move_and_slide
:
motion.x = clamp(motion.x, -MAX_SPEED, MAX_SPEED)
motion.y = clamp(motion.y, -MAX_SPEED, MAX_SPEED)
motion = move_and_slide(motion, UP)