• Post Reply Bookmark Topic Watch Topic
  • New Topic

Motion listener hangs while mouse button is pressed

 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am making a simple space shooter where you use the mouse to move and shoots with the mouse button. I am having trouble with the motion listener i.e the one that listens to mouse movement. When I press the left mouse button and hold it down the motion listener stops responding. The code for the listeners is below.



When I fire(clicking my left mouse button) I can�t move the ship while the button is pressed. I guess there is some kind of conflict between the two listeners but how do I fix this?
 
Stuart Gray
Ranch Hand
Posts: 410
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If the mouse button is held down while the mouse is being moved, it is no longer a mouseMoved event - it is a mouseDragged event. Put you movement code in mouseDragged as well and it should work fine.
 
Unnar Björnsson
Ranch Hand
Posts: 164
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks alot
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!