docsReading time: 2 minutes
General
Basics
- Getting Started
- Game API
- Input API
- Configuration
- Tile Maps
- Resource Management
- Entity Framework
- Control Entities
- User Interface
- utiLITI
- Deployment
- Savegames
- Libraries and Tools
- Glossary
Advanced
- The Particle System
- Dynamic Lighting
- Static Lighting
- Performance Optimization
- Custom MapObjectLoaders
- String Localization
- Object Serialization
- Utility Classes
- Network Communication
- Advanced Entity Knowledge
Tutorials
Texture Atlases
Texture atlases (also called spritesheets) combine multiple sprites into a single image file. LITIENGINE uses them for entity animations and tile rendering.
What is a Texture Atlas?
A texture atlas is a single image containing multiple sub-images (sprites) arranged in a grid or custom layout. Benefits include:
- Reduced memory usage
- Faster rendering (fewer texture swaps)
- Easier asset management
Sprite Info Files
LITIENGINE uses .sprite info files to define spritesheet metadata:
<?xml version="1.0" encoding="UTF-8"?>
<sprite name="player-idle" width="32" height="32">
<animations>
<animation name="idle" keyframes="5" duration="100" loop="true"/>
</animations>
</sprite>Importing Spritesheets
Via utiLITI
- Open Resources -> Import Spritesheets…
- Select your image file
- Configure sprite dimensions
- Set animation properties
Via Code
BufferedImage image = Resources.images().get("sprites/player.png");
Spritesheet sheet = new Spritesheet(image, "player", 32, 32);
Resources.spritesheets().add("player", sheet);Animation Configuration
Frame Dimensions
Set the width and height of each frame:
- If image is 160×32 pixels and each frame is 32×32
- Result: 5 frames horizontally
Frame Duration
How long each frame displays (milliseconds):
- 100ms = 10 frames per second
- 50ms = 20 frames per second
Loop Settings
- Loop: Animation repeats continuously
- No Loop: Animation plays once and stops
Naming Conventions
For automatic animation detection, follow naming patterns:
Entity Animations
{spritePrefix}-{state}-{direction}.{ext}Examples:
player-idle-left.pngplayer-walk-left.pngenemy-attack-right.png
Prop States
prop-{name}-{state}.{ext}Examples:
prop-barrel-intact.pngprop-barrel-damaged.pngprop-barrel-destroyed.png
Using Spritesheets
In Entities
@AnimationInfo(spritePrefix = "player")
public class Player extends Creature {
public Player() {
super("player"); // Uses "player-*" spritesheets
}
}Manual Animation
Spritesheet sheet = Resources.spritesheets().get("player-idle");
Animation animation = new Animation(sheet, true, 100); // loop, duration
entity.getAnimationController().play(animation);Direct Sprite Access
Spritesheet sheet = Resources.spritesheets().get("player-idle");
BufferedImage frame = sheet.getSprite(0); // First frame
g.drawImage(frame, x, y, null);Creating Spritesheets
Recommended Tools
- Aseprite – Pixel art and animation
- TexturePacker – Atlas generation
- Tiled – Built-in tileset editor
Best Practices
- Consistent frame sizes across animations
- Power of 2 dimensions for compatibility (32, 64, 128, 256)
- Minimal padding between frames
- Logical naming following conventions
Spritesheet in Game Files
When you save a project in utiLITI, spritesheets are bundled in the .litidata file:
Resources.load("game.litidata");
// All spritesheets now available via Resources.spritesheets()See Also
- Resource Management – Loading resources
- Sprite Info Files – Sprite metadata format
- Animation Controller – Using animations
Last updated 3 months ago
Feedback / Collaborate
