Mouse woes
by bentgarney · in Torque Game Builder · 03/03/2005 (3:35 am) · 4 replies
#2
As I mentioned in the post, there's a seperate right-mouse version of these calls.
- Melv.
03/03/2005 (4:14 am)
Robert: Naughty boy. Look in the reference doc. ;)As I mentioned in the post, there's a seperate right-mouse version of these calls.
- Melv.
#3
Melv "Mother" May
:)
how could you ask for better support the guy is sick and still manages to answer every question lol
03/03/2005 (7:21 am)
LolMelv "Mother" May
:)
how could you ask for better support the guy is sick and still manages to answer every question lol
Associate Melv May
When you click the mouse and move, it produces "onMouseDragged()" or "onRightMouseDragged()" events, not "onMouseMove()" at that point. You can put the same code in the dragged call as well if you wish (example below).
Also, I'd definately recommend not splitting-up the X/Y components until you have to. No need doing more work and having more variables than you have to. Also, you don't need to store the players position or use globals to transfer stuff like this. Most of the time these variables will be out of date so they are just overhead and confusing.
Just use something like:-
// Mouse Move. function sceneWindow2D::onMouseMove( %This, %Modifier, %WorldPosition, %MouseClicks ) { UpdatePlayer( %WorldPosition ); } // Click and Drag. function sceneWindow2D::onMouseDragged( %This, %Modifier, %WorldPosition, %MouseClicks ) { UpdatePlayer( %WorldPosition ); } // Update Player. function UpdatePlayer( %WorldPosition ) { myPlayer.setPosition( %WorldPosition ); } // Where is my player? echo( myPlayer.getPosition() );- Melv.