Help a noob figure out wall jumping

The basic movement template sadly does not support acceleration or forces well. If there is a player input (direction) then your .x speed is directly set to the max speed, when there isn’t a player input it is using move_toward, but as a such a high rate that it’s similar to immediately setting it to zero speed.

You will have to change most of your velocity sets to use move_toward or addition instead of instant assignments.

For example, converting the above script to use move_toward properly. This assumes you would make a ACCELERATION and DECELERATION variable about eight times your speed.

if direction:
	velocity.x = move_toward(velocity.x, direction*SPEED, ACCELERATION*delta)
else:
	velocity.x = move_toward(velocity.x, 0, DECELERATION*delta)

Some games limit the player’s acceleration in the air, this can help prevent wall climbing while keeping the movement fast.


In this section the wall jump will always result in negative 120 on the x axis, which is only ever to the left. If you want to jump to the right you will need to detect which direction is away from the wall, this can be done with normals.

var normal: Vector2 = get_last_slide_collision().get_normal()
velocity += normal * walljumpHspeed

Make sure to paste scripts with proper formatting