playMaker

Author Topic: Check if mouse is moving  (Read 2533 times)

VascBogdan

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Check if mouse is moving
« on: April 17, 2015, 11:12:54 PM »
How can I check if the mouse is moving ? I need it for a rub, first I check if mouse is holded down then if it is moving. Is there a way ?

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 59
    • View Profile
Re: Check if mouse is moving
« Reply #1 on: April 18, 2015, 12:30:03 AM »
How about getting the mouseX and Y when you register the mouse button down and storing them in variables -- and then comparing them to new mouseX and Y coordinates every frame until the mouse is released?

If the differences are larger or smaller than any tolerance you specify, then the "rub" happened.

/Bad

VascBogdan

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Check if mouse is moving
« Reply #2 on: April 18, 2015, 12:37:58 AM »
Sounds a bit complicated but I am going to try it now. I will reply with the result.

VascBogdan

  • Full Member
  • ***
  • Posts: 118
    • View Profile
Re: Check if mouse is moving
« Reply #3 on: April 18, 2015, 12:48:42 AM »
I actually made it work :) Thank you very much .

TheBadFeeling

  • Junior Playmaker
  • **
  • Posts: 59
    • View Profile
Re: Check if mouse is moving
« Reply #4 on: April 18, 2015, 05:18:05 AM »
You're very welcome!  8)

/Bad