On mouse move

New releases and general discussions.

Post » Wed Dec 17, 2008 5:33 pm

I'd like to request a new condition for MouseKeyboard object: "On mouse move" - it would return FALSE if mouse is not moving and TRUE if it just did.

Alternatively, a new value for it: "Mouse move distance" which would return value of (x2-x1)^2+(y2-y1)^2 where x1,y1 is mouse position in n-1-th tick and x2,y2 is mouse position in n-th (current) tick.

Thanks :)
B
2
G
4
Posts: 12
Reputation: 1,074

Post » Wed Dec 17, 2008 6:08 pm

Why not just do it yourself with global variables? Use this precise order of actions:


Always:
set mouse_dist to distance(mouseX, mouseY, global('old_x'), global('old_y')
set old_x to mouseX
set old_y to mouseY

'Mouse is moving' condition would be equivalent to mouse_dist different to 0, and 'On mouse moved' condition would be equivalent to mouse_dist different to 0 followed by 'Trigger once'.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Thu Dec 18, 2008 3:19 am

just by curiosity, what could be the use of such a condition.
B
2
S
1
G
4
Posts: 114
Reputation: 1,528

Post » Thu Dec 18, 2008 10:27 am

[quote="Border":3eqquy0g]just by curiosity, what could be the use of such a condition.[/quote:3eqquy0g]
Screensavers?
B
4
S
2
G
4
Posts: 719
Reputation: 2,938

Post » Thu Dec 18, 2008 2:13 pm

so true. i completely forget about screensaver.
thanks
B
2
S
1
G
4
Posts: 114
Reputation: 1,528


Return to Construct Classic Discussion

Who is online

Users browsing this forum: No registered users and 0 guests