SGDK makes it easy to load and display sprites from images. At a minimum you want to
- Define a sprite resource in res/resources.res
SPRITE ship "sprites/ship.png" 2 2 NONE
- Load the color palette of the sprite resource
VDP_setPalette( PAL1, ship.palette->data );- Initialize the sprite engine
SPR_init()- Create a Sprite with SPR_addSprite()
Sprite *shipSprite = NULL;
shipSprite = SPR_addSprite( &ship, // Sprite name from resources.res
152, // starting X position
102, // starting Y position
TILE_ATTR(
PAL1, // Palette index
0, // Palette index
FALSE, // Vertical Flip
FALSE // Horizontal Flip
)); - Update the sprite engine in the main game loop
SPR_update();Sega Genesis sprites can be created from 16 color indexed images.
-
Create an image using "File|New...". Set the image width and height to a size supported by SGDK.
-
Convert the image to an Indexed Image using "Image|Mode|Indexed...". Choose a palette with 16 colors or fewer.
- You can use the "Colormap" Dockable Dialog to edit colors if needed.
-
Draw your sprite. Take care to use only 15 color or fewer. The first color is the background color and will be transparent when rendered by SGDK.
-
Once you're doing editing your image, export it as a PNG with "File|Export As..."
- Create a new project using "File|New Project|Create ...". Set the image width and height to a size supported by SGDK.
- In the "Create a new Project" dialog box set the size of your image, the Type to "Sega Megadrive/Genesis (Generic)" and the Color Palette to "rainbow333.pal"
-
Draw your sprite. Take care to use only 15 colors or fewer. The first color is the background color and will be transparent when rendered by SGDK.
-
Reduce the colors in your image to 16. Use "Colors|Reduce Colors..."
- Once you're doing editing your image, save it as a PNG with "File|Save Image As..."