Each step, set a mouse_xprevious and mouse_yprevious. You can then get the direction using point_direction(mouse_xprevious, mouse_yprevious, mouse_x, mouse_y), and likewise, the speed using point_distance(mouse_xprevious, mouse_yprevious, mouse_x, mouse_y).
To also test if the mouse has passed through your object, use this:
if (collision_line(mouse_xprevious, mouse_yprevious, mouse_x, mouse_y, obj_myobject, true, true)) { double dir, spd; dir = point_direction(mouse_xprevious, mouse_yprevious, mouse_x, mouse_y); spd = point_distance(mouse_xprevious, mouse_yprevious, mouse_x, mouse_y); // ... } mouse_xprevious = mouse_x; mouse_yprevious = mouse_y;
|