The Daily Click ::. Forums ::. Klik Coding Help ::. Reverse Mouse-Controlled Object
 

Post Reply  Post Oekaki 
 

Posted By Message

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
14th July, 2012 at 14/07/2012 16:04:38 -

Is there an easy way to make an active object move in the opposite direction of the mouse? (for example: if the mouse cursor is moved up, the object is moved down / mouse cursor is moved left, object moves right, ect.)

 

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
14th July, 2012 at 14/07/2012 16:28:25 -

Let "q" be your game's X resolution and "r" be your game's Y resolution. Let "Active" be the object that you want to move opposite the mouse

Always
->set xCoordinate(Active) q - xMouse
->set yCoordinate(Active) r - yMouse

I hope that's what you wanted. If it's not, just tell me.

Edited by monkeytherat

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.

Buster

BLING COMMANDER

Registered
  03/06/2002
Points
  1545

VIP Member
15th July, 2012 at 15/07/2012 10:28:24 -

Thanks heaps, man. That is exactly what I wanted

 

monkeytherat

Hero of Time Jr

Registered
  07/11/2010
Points
  1293

VIP MemberI donated an open source project
15th July, 2012 at 15/07/2012 17:39:46 -

No problem

 
If you put a million monkeys at a million keyboards, one of them will eventually write a Java program.
The rest of them will write Perl programs.
   

Post Reply



 



Advertisement

Worth A Click