Advertisement
Guest User

Untitled

a guest
May 5th, 2012
435
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.36 KB | None | 0 0
  1. public void update(GameContainer container, StateBasedGame game, int delta) {
  2. float mouseX = container.getInput().getMouseX();
  3. float mouseY = container.getInput().getMouseY();
  4. float xDistance = mouseX - position.x;
  5. float yDistance = mouseY - position.y;
  6. double angle = Math.toDegrees(Math.atan2(yDistance, xDistance));
  7. gun.setRotation((float) angle);
  8. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement