The Spritesheet Converter converts a file to arrays containing one or more sprites. A sprite array, mask array and a combined sprite+mask array are produced. The sprite+mask array contains sprite/mask byte pairs suitable for use with the Sprites drawPlusMask() function.

Note: The mask array produced includes width and height bytes at the beginning. If this array is to be used with the drawExternalMask() function, these bytes must be commented out or deleted.

The filename can be any name but must have the dimensions of a single sprite or tile, in the form _WIDTHxHEIGHT, appended to it before the extension. E.g. to create an array named mySprites with each sprite having a width of 8 and a height of 16 pixels, from a PNG image, the file should be named mySprites_8x16.png. The underscore and dimensions will be removed from the resulting array names.

The image file for multiple sprites or tiles must have them arranged vertically in a single column.

Below is an image that will produce arrays for 3 16x16 sprites. The image contains transparent pixels that will be used for the masks. Its original filename was sprites_16x16.png



In addition to using the produced arrays with the Sprites classes, they can also be used (except sprite+mask) with the Arduboy2Base class drawBitmap() function. For this, the length and width bytes at the start of the array need to be commented out or deleted. To draw a given sprite or tile from an array containing more than one, the proper index into the array would have to be calculated (SpriteNumber * SpriteWidth * SpriteHeight / 8) as a pointer and passed as the bitmap parameter. Masking can be done by first drawing the mask using colour BLACK and then the sprite, at the same position, using colour WHITE (or reverse the two colours to draw the sprite inverted).


Drop your sprite sheet here

Original Licence