How would one create "Graphics, Sprites, Tilesets"?

If I want to make custom sprites would open a special program or do something in the IDE like,

001100
010010
001100

To draw an oval.

The way the graphics works is detailed in the SSD1306 controller manual (section 8.7 and 10.1 are particularly interesting)

But it makes it easier to build off this example: An 8x8 sprite is encoded as 8 bytes. Each byte represents a column, where the leftmost column is the first and the rightmost column is the last. The least significant bit represents the topmost pixel in a column.

Here is how I represent “You” from GLOVE:

PROGMEM const unsigned char playerWalkLeftB[] = {
	0b00000000,
	0b10000100,
	0b11001000,
	0b00111111,
	0b00111111,
	0b01000100,
	0b11001100,
	0b00000000
};

arduboy.drawBitmap(x, y, playerWalkLeftB, 8, 8, 1);

You can see that it can easily be typed in binary where 1 represents white and 0 represents black if you turn your head!

Of course there’s a bit more involved when you want to do larger graphics than 8x8 sprites. But hey, everything I make uses 8x8 sprites and things work great! :stuck_out_tongue:

If you do want to use larger than 8x8 sprites, I recommend writing an image converter in your favorite scripting language. I had a really neat one in javascript where you just had to paste a b&w image into the window and it would spit back an array, but it was lost due to a hard drive crash. If anyone’s interested I can code it again though!

3 Likes

Okay! This is awesome since I have a decent understanding of how to make sprites, but it’s a little time consuming, but hey that’s what makes it feel “old school”! :wink:

There are tools to take normal graphics and turn them into C code… My own:

Takes PNGs and create C code for sprite, sprite mask, combined sprite with mask (for use with ultra fast ArduboyExtra rendering code), and also does frames if you name your file guy8x8.png but have 64 vertical pixels then you’ll get a sprite with 8 frames (also intended for use with ArduboyExtra code which knows about frames).

3 Likes