I was trying to add a omnidirectional dash to my game with this code
if Input.is_action_pressed("ui_accept"):
velocity = Vector2.ZERO
velocity = position.direction_to(get_global_mouse_position()) * 200
And it is only moving the player up and down
I expected it to move based on the mouse's position, it does but only on the y axis, not the x. If I add move_and_slide() to the bottom, it moves along the x axis but not smoothly as it moves abruptly like a teleport.