You no longer load images using new Texture("player.png") . You rely on the Atlas to find your regions.
If you're making a game with libGDX, you will eventually need to draw many images (sprites) on the screen. Loading each image as a separate texture is incredibly inefficient and slow. This is where the comes in.
// 4. Drawing spriteBatch.begin(); playerSprite.draw(spriteBatch); spriteBatch.end(); libgdx texture packer
// Don't forget to dispose! atlas.dispose();
Once you have player.atlas and player.png in your assets folder, load and use them: You no longer load images using new Texture("player
The Texture Packer is one of libGDX's most powerful features. Use it from day one—your frame rate will thank you.
: It can remove transparent pixels around your images to save space, while still allowing the game to "know" the original size. Loading each image as a separate texture is
// 3. Or get an animated region Animation<TextureRegion> walkAnimation = new Animation<>(0.1f, atlas.findRegions("player_walk"), Animation.PlayMode.LOOP);
There are three primary ways to run the Texture Packer. Choose the one that fits your workflow best.
Add this code in your create() method (ideally wrapped in a debug check so it doesn't run in production):