SHARE
TWEET

Untitled

a guest May 5th, 2012 254 Never
  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. }
RAW Paste Data
Top