Mouse movement?
by Denis Linardic · in Torque Game Builder · 10/08/2005 (3:52 am) · 2 replies
Hi guys!
I am new to T2D and this is probably a stupid question, but can you give me example on how to create mouse movement for spacescroller.
I know how to bind mouse button to fire, but I don't know how to detect mouse move up -> Ship move up....
I work with tge for over 2 years but I never need something like that. I've read in TDN and docs that T2D supports mouse movement, so I am asking for a few guidelines..
Thanks!
I am new to T2D and this is probably a stupid question, but can you give me example on how to create mouse movement for spacescroller.
I know how to bind mouse button to fire, but I don't know how to detect mouse move up -> Ship move up....
I work with tge for over 2 years but I never need something like that. I've read in TDN and docs that T2D supports mouse movement, so I am asking for a few guidelines..
Thanks!
About the author
Torque Owner Denis Linardic
Well I am using this code.
new ActionMap(playerMap); // Create Player Map. cursorOff(); //Deno dodao Mouse control playerMap.bindCmd(mouse, button0, "playerFire();", "playerFireStop();"); playerMap.bind( mouse, "yaxis", handleMouseY ); playerMap.bind( mouse, "xaxis", handleMouseX); playerMap.bindCmd(keyboard, "w", "playerUp();", "playerUpStop();"); playerMap.bindCmd(keyboard, "up", "playerUp();", "playerUpStop();"); ....And so on....function handleMouseY( %val ) { echo( "MouseY" SPC %val ); $MouseY = %val; }I am pretty sure that error lies here...
function playerUp() { // Set it moving up. //$player.setLinearVelocityY( -$movementSpeed ); $player.setLinearVelocityY(-$MouseY ); }My guess is that player.setLinearVelocity is the problem, I've tried with setPosition but nothing happens. Console doesn't give any error.
Any Ideas???