Could you only apply the .x of your vectors?
.x
linear_velocity.x = direction.x * speed
Make sure to paste scripts instead of screenshots