1

I am in the process of creating a top down shooter in Java 7. I want to rotate an image with the coordinates of a mouse on a JFrame panel. I was told that using a Vector2D class is the best way to conquer this task. The player image is 40x40 and the panel is 1000x800. Any and all help is greatly appreciated.

pooperdooper
  • 155
  • 4

1 Answers1

0

I would try this to get the angle to the mouse:

float angle = (float) (Math.toDegrees(Math.atan2(player.y - mouse.y, player.x - mouse.x)));
Andrew Cumming
  • 965
  • 6
  • 14