简体   繁体   中英

Rotate Atlas Region Libgdx

protected TextureAtlas atlas = Assets.manager.get(Constants.ATLAS_PATH, TextureAtlas.class);

AtlasRegion region = interfaceAtlas.findRegion("arrow");

I've load an image like this ( http://marinedealerconference.com/wp-content/uploads/2015/07/right.png ): an arrow that points right...

But I can't find a way to rotate it! How can I? Because I want it goes down.

you cannot rotate region although you can rotate Sprite or Image

    //sprite:
    public void rotate(float degrees)

    //image - remember to set origin to the center here!
    public void rotateBy(float amountInDegrees)

Instead of rotating the region itself you can "tell" SpriteBatch to draw it rotated:

    batch.draw(region, x, y, originX, originY, width, height, scaleX, scaleY, rotation);

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