FlashPunk TextureAtlas


(Jeff Williams) #22

A texture atlas is a texture composed of multiple sub-textures.

That’s pretty much the minimal definition, and unfortunately their use case is just as ambiguous. You could store multiple independent sprites in an atlas. You could store a single animation composed of uniformly sized sprites. You could store hundreds of animations of arbitrarily sized sprites.

What they do best is allow you to contain what would be multiple separate asset files as a single texture asset. You can ideally treat these however you want: as part of an animation, tile set, or standalone sprites. In this case, sub-textures are specified either in code through TextureAtlas.defineSubtexture, or through an associated XML file.