1

Hello dear stackoverflowers, i stumbled across a problem while building my game, i want to shoot a sword to the mouse position if clicked and it works, but, the only problem is that when you move the frame manually on my window, the mouse variables change, im using the command : MouseInfo.getPointerInfo().getLocation().x and y; to find the position on frame, i believe the problem is there, is there a replacement for this command>? Thanks.

elamar
  • 11
  • 2
  • [Add a MouseListener](http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#addMouseMotionListener-java.awt.event.MouseMotionListener-) to your game. You should also [monitor mouseEntered and mouseExited events](http://docs.oracle.com/javase/8/docs/api/java/awt/Component.html#addMouseListener-java.awt.event.MouseListener-). – VGR Jul 20 '17 at 19:38
  • thanks it really helped – elamar Jul 20 '17 at 19:41

0 Answers0