how to detect mouse drag and mouse movement events

For questions about using Classic.

Post » Wed Mar 25, 2009 11:48 pm

Hi
Is there way to listen to mouse drag or motion events? There is no motion events for for the mouse_keyboard object.
Specifically I am looking for the dx & dy values during a mouse motion event. Any idea how to detect these ?
I am trying to implement gesture detection for my game.
Any ideas how to go about this ?

thanks
Rudy
B
1
S
1
G
3
Posts: 2
Reputation: 979

Post » Thu Mar 26, 2009 1:08 am

Have two global variables, OldMouseX and OldMouseY. At the bottom of the event list have 'Always - set OldMouseX to MouseX, set OldMouseY to MouseY'. In the events above this, MouseX - OldMouseX is dx, MouseY - OldMouseY is dy. If either are nonzero, the mouse is moving.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842

Post » Thu Sep 14, 2017 7:07 am

@Ashley - what does "MouseX - OldMouseX is dx" mean? I'm trying to set up an idle detection state
B
43
S
13
G
8
Posts: 622
Reputation: 7,392

Post » Thu Sep 14, 2017 12:44 pm

Well, I posted that about eight years ago, but I think I meant just a simple subtraction between the current mouse position and the last mouse position gives you the change.
Scirra Founder
B
395
S
233
G
88
Posts: 24,376
Reputation: 193,842


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 24 guests