8 way direction

Hey what’s up ?
I haved some problem for 8 way direction with mouse so i wrote this very simple line for help some person.

var direction:Vector2 = round((get_global_mouse_position() - position).normalized())

The mouse position can be exchange with the joypad joystick i think.

For the pleasure of helping !