Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import org.newdawn.slick.Image;
- import org.newdawn.slick.Input;
- /**
- *
- */
- public class SO10461993Test {
- private Image image;
- private float x;
- private float y;
- public SO10461993Test(Image image) {
- this.image = image;
- x = 300;
- y = 400;
- }
- public void update(Input input, float delta) {
- float mouseX = input.getMouseX();
- float mouseY = input.getMouseY();
- float xDistance = mouseX - x;
- float yDistance = mouseY - y;
- double angleToTurn = Math.toDegrees(Math.atan2(yDistance, xDistance));
- image.setRotation((float)angleToTurn);
- }
- public void draw() {
- image.draw(x, y);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement