简体   繁体   中英

Java: Rotate bufferedimage without affecting the image's position

g.rotate(1, objSize/2, objSize/2);
g.drawImage(frames[count], (int)x, (int)y, null);
g.rotate(-1, objSize/2, objSize/2);

This is the coding I used to rotate one image which is the Player that you can move, the player rotates fine but it moves like the whole world has rotated (if you know what I mean) so I need to know a way to rotate the player without affecting the movement/position, I searched around google and couldn't find the right answer, any suggestions?

Create a method that rotates the player and pass the values which are required to move the player.. (i mean abstact a class out of the code u wrote to rotate and just pass required values to method)..

this will not change the values and Do the work..

:)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM