How to make my platform change direction when hitiing a collusional shape

Move move_and_slide before the is_on_wall check:

func _physics_process(delta):
	velocity.x = speed * direction

	move_and_slide()

	if is_on_wall():
		direction *= -1
1 Like