Packed Sprite Sheets

From Slick2D Wiki
Revision as of 13:32, 15 May 2018 by 81.247.3.17 (Talk) (Undo revision 532 by Abc123456 (talk))

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Basic sprite sheets are pretty useful if you're building a simple set of sprites into a sheet. However, sprite sheets can get more complicated, where multiple different size sprites need to be packed into a single sheet. Doing this by hand is both hard and inefficient - luckily there's a nice tool build for the job named ImagePacker.

The image packing tools allows you to build a single image out of many smaller ones and it optimizes the layout of this sprites onto the sheet. Of course the layout of sprites is important and so the tool produces a descriptor file which defines where different named sprites are placed.

Slick provides the PackedSpriteSheet class which allows you to load both the packed image and the descriptor file. The class then provides methods to get individual images from the sheet either as separate images or interpreted as an embedded sprite sheet. This allows you to utilize the packed sprites as with any other image and what's more allows you to embed animation sprite sheets into larger sheets of sprites.

See Also[edit]