Game Development Community

Know if mouse is going right or left

by Isaac Barbosa · in Torque Game Builder · 05/24/2008 (12:07 pm) · 3 replies

Hi,

I want to know how to identify the direction the mouse is taking once onMouseDragged();

I'm trying to swap some stuff so if I click in a given piece of my game and I want to move the mouse to the right, how to know that, the direction the mouse is moving?

I hope this makes sense.

Thanks

#1
05/24/2008 (12:59 pm)
The Breakout Tutorial has a section in it that shows you how to get which direction the mouse is moving.
#2
05/24/2008 (2:12 pm)
Thanks Jeremy, I will try that!
#3
05/25/2008 (4:54 pm)
A really basic way to do it is you could just compare it's last location to it's current location. If the current location has a greater X value, it's going to the right.