Learning Sprites
Moderator: Stef
Learning Sprites
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?
-
- Very interested
- Posts: 3131
- Joined: Thu Nov 30, 2006 9:46 pm
- Location: France - Sevres
- Contact:
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 :
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 .
- 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