所以我有一个矩形,我想要改变它的精灵90度顺时针而不改变它的位置。更改sprite在LIBGDX中的矩形
这里就是我的了:
//sprites I want to use
Up = new Texture("left.png");
Down = new Texture("right.png");
Left = new Texture("down.png");
Right = new Texture("up.png");
//the Rectangle
square = new Rectangle();
square.x = 630;
square.y = 720/2 - 32 /2;
square.width = 32;
square.height = 32;
上
渲染()
batch.begin();
batch.draw(Right, square.x, square.y);
batch.end();
等与我想改变矩形精灵与上面的精灵。 我会感谢一些帮助!
SpriteBatch有一个方法用于绘制带有旋转的纹理或纹理区域(关于左下角)。因此,用旋转角度和一些偏移量来绘制左下角应该保持所需位置的位置。 – Tenfour04