Libgdx Texture: Packer

Run this main method every time you change your assets. Once you have player.atlas and player.png in your assets folder, load and use them:

Write a simple Java class or Gradle task to run the packer: libgdx texture packer

Add the dependency to your core/build.gradle : Run this main method every time you change your assets

// (input directory, output directory, atlas file name) TexturePacker.process(settings, "raw-assets/player", "android/assets/", "player"); atlas file name) TexturePacker.process(settings

dependencies // ... your other dependencies compileOnly "com.badlogicgames.gdx:gdx-tools:$gdxVersion"

raw-assets/player/ ├── idle/ │ ├── frame1.png │ └── frame2.png └── run/ ├── run01.png └── run02.png You can access atlas.findRegion("idle/frame1") or atlas.findRegions("run") .

// 4. Or create a full Sprite (with color, rotation, etc.) Sprite playerSprite = atlas.createSprite("player_jump");