Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 

README.md

Basic Sprite Example

SGDK makes it easy to load and display sprites from images. At a minimum you want to

  1. Define a sprite resource in res/resources.res
SPRITE ship "sprites/ship.png" 2 2 NONE
  1. Load the color palette of the sprite resource
	VDP_setPalette( PAL1, ship.palette->data );
  1. Initialize the sprite engine
  SPR_init()
  1. 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
					));	
  1. Update the sprite engine in the main game loop
  SPR_update();

Sprite Image Creation

Sega Genesis sprites can be created from 16 color indexed images.

GIMP

  1. Create an image using "File|New...". Set the image width and height to a size supported by SGDK.

  2. Convert the image to an Indexed Image using "Image|Mode|Indexed...". Choose a palette with 16 colors or fewer.

Convert Image

  1. You can use the "Colormap" Dockable Dialog to edit colors if needed.

Color Map

  1. 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.

  2. Once you're doing editing your image, export it as a PNG with "File|Export As..."

Pro Motion NG

  1. Create a new project using "File|New Project|Create ...". Set the image width and height to a size supported by SGDK.
  2. 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"

New Project

  1. 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.

  2. Reduce the colors in your image to 16. Use "Colors|Reduce Colors..."

Reduce Colors

  1. Once you're doing editing your image, save it as a PNG with "File|Save Image As..."

Save as PNG