// Or with animation Array<TextureRegion> frames = atlas.findRegions("character/run"); Animation<TextureRegion> animation = new Animation<>(0.1f, frames);
// Atlas options settings.combineSubdirectories = true; settings.flattenPaths = true; settings.useIndexes = true; settings.alias = true; settings.debug = false; libgdx texturepacker
A command-line and GUI utility that aggregates multiple individual image assets into one or more larger images (Texture Atlases) and generates the associated metadata file ( *.atlas ) required for efficient rendering. // Or with animation Array<
// build.gradle project(":desktop") { dependencies { implementation "com.badlogicgames.gdx:gdx-tools:$gdxVersion" } task packTextures { doLast { import com.badlogic.gdx.tools.texturepacker.TexturePacker TexturePacker.process("assets-raw/images", "assets/images", "game-atlas") } } frames = atlas.findRegions("character/run")
If you have two identical images, the packer will only store one copy but give you two different names in the atlas file, saving space. Implementing the Atlas in Code
You can actually pack textures programmatically while your game is running (though this is usually done during development, not in the final production build).