Code:
var mouse_dir = point_direction(x,y,mouse_x,mouse_y)
Then, depending on how many directions your character can face:
Code:
//4 directions
facing_direction = round(mouse_dir/90);
Code:
//8 directions
facing_direction = round(mouse_dir/45);
The value of facing direction can now be used in a switch() statement or what have you, with its value ranging from 0-4 or 0-8 (depending on which one you used). 0 and the max value for facing direction (be it 4 or 8) can be your switch statements default case.
Code:
//4 directions
switch(facing_direction)
{
case 1: sprite_direciton = sprite_up; break;
case 2: sprite_direction = sprite_left; break;
case 3: sprite_direction = sprite_down; break;
default: sprite_direction = sprite_right; break;
}