Implementing acceleration in a 2D Platformer for Noobs

velocity.x means the velocity of the character on the x axis. move_toward means the character will increase/decrease its speed in increments according to the following parameters: velocity.x is the starting point, the second number is the goal velocity, and the last number is the size of the increments. the last number comes default as the constant “speed”, but you can change it to any number you like to change how fast or slow the character will accelerate/decelerate.

2 Likes