Libgdx 动画无法正确渲染

Libgdx 动画无法正确渲染,libgdx,Libgdx,我正在使用以下代码渲染在另一个类中创建的精灵: batch = new SpriteBatch(); textureAtlas = new TextureAtlas(Gdx.files.internal("bird.atlas")); animation = new Animation(1/6f, textureAtlas.getRegions()); 我的问题是,它不会运行不同的图像,而是得到一个静态图像。如果我将动画中的速度更改为1/10000f,它将像crasy一

我正在使用以下代码渲染在另一个类中创建的精灵:

    batch = new SpriteBatch();
    textureAtlas = new TextureAtlas(Gdx.files.internal("bird.atlas"));
    animation = new Animation(1/6f, textureAtlas.getRegions());
我的问题是,它不会运行不同的图像,而是得到一个静态图像。如果我将动画中的速度更改为1/10000f,它将像crasy一样翻转图像

这是bird类中render方法中的代码,然后我运行renderer.render();从游戏课上

    batch.begin();
    elapsedTime = Gdx.graphics.getDeltaTime();
    batch.draw(animation.getKeyFrame(elapsedTime, true), 50, 50);
    batch.end();
这将显示我的鸟在我的平铺地图上,但然后鸟不拍打他的翅膀:(非常悲伤

libgdx版本:1.5.5


你知道我要误入歧途吗?

动画需要的是elpased时间,而不是delta时间。你的
elapsedTime
变量只存储delta时间


elapsedTime=Gdx.graphics.getDeltaTime();
更改为
elapsedTime+=Gdx.graphics.getDeltaTime();

谢谢,我完全错过了那个!