AndEngine is now able to read a format exported from the awesome sprite-packing tool called TexturePacker ( http://www.texturepacker.com/ ), written by Andreas Löw. The tool has a free version, which shows you how powerful this tool is. The pro version with all features is definitely worth it's money and if you cannot afford it now, then TexturePacker is definitely worth investing your first revenue you made with your previous app.
The special thing is that it will come with compile-time safety of accessing the sprites on the spritesheets, kind of similar to accessing i.e. resources like R.drawable.something. Combined with a few new commandline parameters introduced in the upcoming version of TexturePacker, you'll be able to create/update your spritesheets with one click and have instant compiletime safety in your code! How awesome is that
You can download TexturePacker here: http://www.texturepacker.com/download/
The extension code is located here: http://code.google.com/p/andenginetextu ... extension/
The example is located here: http://code.google.com/p/andengineexamp ... ample.java
An example buildscript is located here: http://code.google.com/p/andengineexamp ... esheets.sh
The buildscript is well documented, and all you need to change are the UPPERCASE variables in the top.
When running the script:
- The images get combined into one/more spritesheet(s)
- An XML File is being created that contains meta-information on where the images are located in the spritesheet and information about rotation, trimming and finally an ID.
- A Java interface is generated that looks like this:
The great thing is that you can reference the TextureRegions in the SpriteSheet not by their name (which is error-prone), but by an ID (which means compiletime safety )
If that is not great, I don't know