func jump(delta):
velocity.y = JUMP_VELOCITY
func player_movement(delta: float) -> void:
if not is_on_floor():
velocity.y += gravity * delta
if is_on_wall() and Input.is_key_pressed(KEY_W):
canMoveX = false
jump(delta)
velocity.x = - velocity.x*2
position.x += -direction*4
else:
canMoveX = true
if Input.is_key_pressed(KEY_W) and is_on_floor():
jump(delta)
if Input.is_key_pressed(KEY_A):
direction = -1
velocity.x = -SPEED
elif Input.is_key_pressed(KEY_D):
direction = 1
velocity.x = SPEED
else:
if canMoveX == true:
velocity.x = 0
im trying to add a wall jump
but it wont launch you in the other direction