Learning Sprites

SGDK only sub forum

Moderator: Stef

Post Reply
matteus
Very interested
Posts: 336
Joined: Mon Feb 04, 2008 1:41 pm

Learning Sprites

Post by matteus » Wed Aug 12, 2015 12:06 pm

Does anyone have a decent tutorial on the use of sprites? I've seen some sprite sheets in the examples included with the SDK but I'm not sure how these sprite-sheets translate into actual sprites in game? Is there a specific standard for the sprite-sheets I need to abide too?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Wed Aug 12, 2015 9:10 pm

Hi Matteus,

Did you read the "sprite" sample given in SGDK ? It's a very simple but self explanatory example :)
Also taken from the rescomp.txt file :
SPRITE name img_file width heigth [compression [time [collision]]]

name name of the output SpriteDefinition structure
img_file path of the input image file (should be 8bpp .bmp or .png)
width width of a single sprite frame in tile (should be <= 20)
heigth heigth of a single sprite frame in tile (should be <= 20)
compression compression type (use unpackSprite(..) to unpack)
-1 = AUTO (use best compression scheme)
0 = NONE (no compression)
1 = APLIB (aplib library)
2 = LZKN (Konami LZW compression, disable for legal reason)
3 = RLE (4bits RLE compression)
4 = RLE MAP (tilemap adapted RLE)
time display frame time in 1/60 of second (time between each animation frame)
collision collision type: CIRCLE, BOX or NONE (BOX by default)

Some informations about how SpriteDefinition is generated from the input image:
- input image dimension is aligned on tile (multiple of 8).
- input image is a grid where each cell represents a single sprite frame and where a row define a complete sprite animation.
- cell size (frame size) = width * height (in tile)
- a frame can be composed of several internal VDP sprites (max = 20) if width or height are > 4.
- rescomp detect flipped frame to avoid redundant sprite tiles.
- rescomp detect empty frame at end of animation row to not store empty frame data.
- rescomp detect frame copy inside an animation to generate the according animation sequence.
- collision bounds are calculated by using 75% of the original sprite frame.
- In future rescomp could detect empty tiles in a frame to optimize the internal VDP sprite usage (and also improve the collision box).
That may be a nice future addition :)

Post Reply