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
G
3
Posts: 2
Reputation: 829

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
359
S
214
G
72
Posts: 22,951
Reputation: 178,578


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 4 guests