Can someone explain this navigation formula!

ok so built something right now that is a little jank, but its gets out the point i'm trying to give you for smooth movements, I just don't have it perfect for grid stuff... var directiong; directiong = 0

movedir = point_direction(x,y,mouse_x,mouse_y);

if (22.4 > movedir and movedir < -22.4) { directiong = 0; } else if (67.4 > movedir and movedir < 22.5) { directiong = 45;
} else if (112.4 > movedir and movedir < 67.5) { directiong = 90;
} else if (157.4 > movedir and movedir < 112.5) { directiong = 135;
} else if (202.4 > movedir and movedir < 157.5) { directiong = 180;
} else if (247.4 > movedir and movedir < 202.5) { directiong = 225;
} else if (292.4 > movedir and movedir < 247.5) { directiong = 270;
} else if (337.4 > movedir and movedir < 292.5) { directiong = 315;
}

if mouse_check_button(mb_left) { direction = directiong speed = 1 draw_text(x,y,directiong) } else { direction = 0 speed = 0 }

/r/gamemaker Thread Parent