使用LibGDX,你如何使用单独的图像动画?

Leo*_*QLF 1 java eclipse animation android libgdx

我正在学习如何使用LibGDX制作游戏,我正在尝试制作一个小型平台游戏(使用Eclipse).我在主角上运行了4张图像,以便在移动时制作动画.但是,我在网上找不到任何东西,告诉我如何在不使用SpriteSheet的情况下制作动画.你如何使用4种不同的图像制作动画?

noo*_*one 5

首先:你不应该使用不同的图像.也许对你的播放器来说它并不重要(因为只有一个),但一般来说你应该总是使用精灵表,也就是说TextureAtlas.

但是,没有它可以使用不同的纹理.

TextureRegion tex1 = new TextureRegion(new Texture("play_anim_1"));
TextureRegion tex2 = new TextureRegion(new Texture("play_anim_2"));
TextureRegion tex3 = new TextureRegion(new Texture("play_anim_3"));
TextureRegion tex4 = new TextureRegion(new Texture("play_anim_4"));

Animation playerAnimation = new Animation(0.1f, tex1, tex2, tex3, tex4);
Run Code Online (Sandbox Code Playgroud)