This site requires JavaScript, please enable it in your browser!
Greenfoot back
JetLennit
JetLennit wrote ...

2013/5/23

Finding mouse speed

JetLennit JetLennit

2013/5/23

#
Is there a way to find the speed of the mouse with code? (or the speed of an object being controlled by the mouse)
danpost danpost

2013/5/23

#
Yeah. You will need to save the coordinates of the object (or mouse) on one act and then get the coordinates again on the next act. Using the differences in the two getX and getY values, you can determine the distance between the two points. Comparing two consecutive distances would give an average speed between the two moves.
You need to login to post a reply.