Rotate Image around character (JAVA)

后端 未结 2 1415
小鲜肉
小鲜肉 2020-11-27 23:58

Yes, i do know you can use AffineTransformation, however i want my sword image to rotate around a character that i have made (black block drawn in graphics) 360 degrees vis

2条回答
  •  -上瘾入骨i
    2020-11-28 00:30

    The Graphics2D class, has a method g2.rotate(...), call a for loop setting the rotate at one degree more, at a time, then invoke g2.drawImage(...), in the loop, after the each change (if it's in the paintComponent() method, and the loop is outside - call repaint() in the for loop).

提交回复
热议问题