I have not used Genesis Sprite Studio so I'm not sure how much of this post applies to you. Hopefully it helps.
Firstly, check out this exmaple:
https://github.com/Stephane-D/SGDK/tree ... ple/sprite
This is what is involved in making it work.
1. Create a PNG file with indexed color (16 color palette) like this one, and put it in the "res" folder:

Each row is an "animation", and each column is a "frame" within those animations. rescomp can detect duplicate frames, so you don't have to worry about loading the same one in memory twice. It also detects blank frames and does not show those either.
2. In that same folder should be a resources.res file, if not create one (filename doesn't matter as long as it ends in .res):
Code: Select all
SPRITE sonic_sprite "sonic.png" 6 6 -1 5
Based on the documentation for the rescomp tool (
https://raw.githubusercontent.com/Steph ... escomp.txt) this line will do the following:
- SPRITE - create a sprite
- sonic_sprite - This is the name of the sprite in your code
- "sonic.png" - The filename/path to the png image to convert to an SGDK sprite
- 6 - Number of columns (there are up to 6 frames per animation)
- 6 - Number of rows (there are 6 animations, one for standing, walking, etc)
- -1 - Use whichever compression it wants
- 5 - Speed for frame advance, the sprite will animate once every 5 frames
3. When the game is build this will generate a header file for you to include that contains a pointer to sonic_sprite. In the code you want to:
Code: Select all
#include <genesis.h>
// Include the generated resource file containing the sprite (whatever_you_named_the_res_file.h)
#include "resources.h"
// Declare an array for your sprites (must be actual sprites and not pointers)
Sprite sprites[2];
int main() {
VDP_init();
// Initialize the sprite engine
SPR_init(256);
// If you want get the palette from the sprite
VDP_setPalette(PAL2, sonic_sprite.palette->data);
// Or from a palette you defined yourself if you want to share the same palette among many sprites
//VDP_setPalette(PAL2, MY_PAL.data);
// Initialize the sprite itself
SPR_initSprite(&sprites[0], &sonic_sprite, 4, 4, TILE_ATTR(PAL2, TRUE, FALSE, FALSE));
while(1) {
// Update the sprites in the array, since there is only 1 sprite update 1
SPR_update(sprites, 1);
VDP_waitVBlank();
}
}
I didn't actually test the code I wrote there but it is based on the sprite example with the extra stuff removed. If you compile the sprite example I think it lets you move around and show different animations.