Altering the y and not the x, that looks like something you'll need the bounce functionality for. The example found here might work right out of the box for you (see the section about KinematicBody2D):
[https://docs.godotengine.org/en/3.1/tutorials/physics/physics_introduction.html](http:// "https://docs.godotengine.org/en/3.1/tutorials/physics/physics_introduction.html")
I'm using it myself in my project. The local Vector2 variable velocity is used as an intermediate variable. It can be changed manually in the process event, if required. The actual movement (with an eventual, additional collision) takes place in the physics_process event. Works fine.
var velocity = Vector2(1, 1)
func _physics_process(delta):
var collision = move_and_collide(velocity * delta)
if collision:
velocity = velocity.bounce(collision.normal)
pass