Because how fast you can move mouse (you can move it faster then a frame skips)
I can’t think of any accurate way to do it
My 1st stupid idea is to create sprite object and apply force to it toward CursorX() CursorY()
Like very high INSTANT force something above 500 or even 1000
And now you can check angle of movement with forces of that object
This would tell you more or less which direction cursor is moving
Up would be 270° angle with 45° tolerance
Left 180°
Right 0°
Down 90°
ALL with 45° tolerance
Hi Inferno, you could try something like this. I did not test it thoroughly, so not sure if it’s bulletproof, and to make it work, the readout is done with a delay of 0.1sec.
But here’s one way to do it:
you write the position of the mouse to a variable (I write it to an array - one child for the X and one for Y)
add a “Wait 0.1 sec” before writing down the variable
then you compare the current mouse X and Y position to the values in the array
if X is bigger than the variable, it’s Right, else it’s Left
if Y is bigger than the variable, it’s Down, else it’s Up
That’s just to figure out the direction of the biggest mouse movement - horizontally or vertically.
So if the mouse moves vertically 20 pixels and horizontally 30 pixels, then the overall movement is taken as being left- right because the absolute X difference is greater than that of the Y difference. The sub events then determine whether the horizontal movement is to the left or right.
It’s the same steps for vertical movements, but using the up-down change in mouse position.