I am getting started on a game in JAVA, which eventually shoould become an android app. anyway, i was wondering How to rotate an image (I eventually want to rotate a character to face the mouse, if you know how to do this it would be AMAZING!). Anyway, this is what i use to load the image:
ImageIcon i = new ImageIcon("C:/image.jpg");
Any ideas? a rotate(Image image, int angle){} method would be great!
If you knew how to rotate an image towards the mouse, that would be even better! Thanks for your time
you can’t make a game with
ImageIcons. you have to use gava.awt.Paint2D and paint to an image. then you can rotate it by setting the affline transform. here i answered a similar wuestion in more depth:Platform Game – Getting the Object to adjust angle according to mouse position
and a tutorial on java game programming in general:here