【问题标题】:libgdx - sprite does not rotatelibgdx - 精灵不旋转
【发布时间】:2014-11-09 01:37:05
【问题描述】:

这是 create() 方法:

batch = new SpriteBatch();
texture = new Texture(Gdx.files.internal("spaceships/tfighter0.png"));
sprite = new Sprite(texture);
sprite.setOrigin(sprite.getWidth()/2, sprite.getHeight()/2);
sprite.rotate(180f);

还有render()方法:

Gdx.gl.glClearColor(0, 0, 0, 0);
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
batch.begin();
batch.draw(sprite ,200,200);
batch.end();

现在不应该旋转精灵吗?无论我在旋转方法中放入什么角度,它看起来都与 png 相同。

【问题讨论】:

    标签: rotation libgdx sprite


    【解决方案1】:

    使用

    sprite.draw(batch)
    

    代替

    batch.draw(sprite,x,y)
    

    有效

    【讨论】:

      猜你喜欢
      • 2014-04-04
      • 2014-09-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多