Java 在使用图像时旋转图像
我正在创建一个汽车游戏,我想在使用汽车时旋转我的汽车图像,但我不知道如何旋转。我试过一些不起作用的东西。以下是我所拥有的:Java 在使用图像时旋转图像,java,image,rotation,awt,Java,Image,Rotation,Awt,我正在创建一个汽车游戏,我想在使用汽车时旋转我的汽车图像,但我不知道如何旋转。我试过一些不起作用的东西。以下是我所拥有的: g2d.drawImage(DEFAULT_CAR_SKIN, DEFAULT_BOX.x, DEFAULT_BOX.y, null); DEFAULT_BOX.setLocation(DEFAULT_BOX.x + 1, DEFAULT_BOX.y); if (Game.rotateFront == true) { AffineTransform identity
g2d.drawImage(DEFAULT_CAR_SKIN, DEFAULT_BOX.x, DEFAULT_BOX.y, null);
DEFAULT_BOX.setLocation(DEFAULT_BOX.x + 1, DEFAULT_BOX.y);
if (Game.rotateFront == true) {
AffineTransform identity = new AffineTransform();
AffineTransform trans = new AffineTransform();
trans.setTransform(identity);
trans.rotate(Math.toRadians(Game.Angle));
g2d.drawImage(DEFAULT_CAR_SKIN, trans, this);
}
但是这段代码绘制了一个新的图像,但是具有我想要的特征。。但是具有我想要的特征。除非你的意思是…但不是我想要的特征。这种说法毫无意义。为了更快地获得更好的帮助,请发布一个最小的完整的可验证示例。