Architecture:Sprite Format
Jump to navigation
Jump to search
Example Sprites
The following XML structure describes the smallest possible Sprite with only one state and one animation frame.
<?xml version="1.0"?> <list id="default"> <list id="data/gfx/map/ground/outside/grass/long-grass-tile.png"> <bool id="mask">0</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">0</u_int32> </list> </list>
The following structure is part of a character sprite.
<?xml version="1.0"?> <list id="e_stand"> <list id="data/gfx/char/npc/ng/east_mov1.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">0</u_int32> </list> </list> ... <list id="e_walk"> <list id="data/gfx/char/npc/ng/east_mov1.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> <list id="data/gfx/char/npc/ng/east_mov2.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> <list id="data/gfx/char/npc/ng/east_mov3.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> <list id="data/gfx/char/npc/ng/east_mov4.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> <list id="data/gfx/char/npc/ng/east_mov5.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> <list id="data/gfx/char/npc/ng/east_mov6.png"> <bool id="mask">1</bool> <bool id="mirrored_x">0</bool> <u_int32 id="delay">250</u_int32> </list> </list> ...
Parameters of a Sprite
Each sprite consists of a number of states (i.e. default, e_stand or e_walk) which will be referred to by corresponding map objects. Each state contains a list of images that make up an animation graphically representing that state. Each image has the following properties:
- mask whether the image contains magenta-colored (#FF00FF) pixels that should be transparent
- mirrored_x whether the image will be mirrored along the vertical axis after loading
- delay the timespan before the next animation frame is displayed in milliseconds
Note that if the same frame is contained multiple times in the sprite, it will still be loaded only once by the engine, due to the surface caching implemented in the graphics module.