I was working with sprites last night, and finally got something coded that I’ve had running around in the back of my head for months: the concept of an Action Matrix.
It sounds a lot more complicated than it is, but it’ll be very useful to developers who want to do character animations. An action matrix is associated with a sprite (or more than one sprite, if you want) and defines the sequence of frames for all the animations it uses. For example, the default action matrix for a sprite imported from RPG Maker 2000 looks like this:
[(0, 1, 2, 1),
(3, 4, 5, 4),
(6, 7, 8, 7),
(9, 10, 11, 10)]
Open up a charset graphics file and start counting frames for a character, and you’ll see that the individual sets represent the sequence used for a character to walk. But TURBU sprites will be able to include as many frames as you’d like. So if you want a Legend of Zelda-style death scene, (remember back in the original, where Link spins around several times, then vanishes in a little puff?), add two frames for the puff, and define the animation:
(1, 4, 7, 10, 1, 4, 7, 10, 1, 4, 7, 10, 1, 4, 7, 10, 12, 13)
Animations created using the action matrix can be activated using a script command. No more weird Change Sprite/Change Direction (and then remember to change everything back!) combos for custom animations. You want Chrono Trigger-style characters that can dance, jump, laugh and freak out? Then build these animations for them with as many frames per character sprite as you’d like (up to a max of 256), define an action matrix, and watch these abilities become an integral part of your character’s sprite.