I tried to do this, but I need the sprite to rotate to the left if the point where you want to turn closer than if you rotate to the right side
var direction = Vector2(Input.get_joy_axis(0, JOY_ANALOG_RX), Input.get_joy_axis(0, JOY_ANALOG_RY)).angle()
var target_angle = 0
var turn_speed = deg2rad(1)
if abs(direction) < turn_speed:
rotation += direction
else:
if rotation < direction: rotation += turn_speed
if rotation > direction: rotation -= turn_speed