所以我有一個矩形,我想要改變它的精靈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