The Tilesheet Converter converts a file to an array of one one or more square tiles. Tiles are assumed to be solid, with no transparency, so no masks are produced.

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.

Here is an image that will produce arrays for 3 16x16 tiles or sprites (or a single 16x48 image array with the Image Converter). There are no transparent pixels. Its original filename was tiles_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 tile sheet here

Original Licence