J
Jonar
Guest
I think the title explains the question that I am asking pretty well. Thanks in advance to anyone that answers.
//start event
moveit = 0
mxp = mouse_x
myp = mouse_y
//step event
if mxp != mouse_x or myp != mouse_y
{
if moved != 1 {moved = 1}
}else{
if moved != 0 {moved = 0}
}
if mxp != mouse_x {mxp = mouse_x}
if myp != mouse_y {myp = mouse_y}
if moved = 1
{
//the mouse just moved, go do something in between these brackets
}
mx = mouse_x;
my = mouse_y;
// get distance from fake mouse to real mouse
var moving = point_distance(mx, my, mouse_x, mouse_y);
// update positions of fake mouse
mx = mouse_x;
my = mouse_y;
// if they are apart
if (moving) {
}
I like this method a lot! To be honest, I didn't even know that point_distance() existed before this...Couldn't you just do this?
create
stepCode:mx = mouse_x; my = mouse_y;
Code:// get distance from fake mouse to real mouse var moving = point_distance(mx, my, mouse_x, mouse_y); // update positions of fake mouse mx = mouse_x; my = mouse_y; // if they are apart if (moving) { }
// step
if point_distance(mouse_x_past, mouse_y_past, mouse_x, mouse_y)
{ // if mouse is moving
window_set_cursor(cr_default);
}
else if alarm[2] <= 0 alarm[2] = sec(3);
mouse_x_past = mouse_x;
mouse_y_past = mouse_y;
// alarm[2]
window_set_cursor(cr_none);
mx = mouse_x;
my = mouse_y;
if ( mx = mouse_x && my = mouse_y ) {
window_set_cursor(cr_none);
}
else {
window_set_cursor(cr_arrow);
}
mx = mouse_x;
my = mouse_y;