Monday 8 June 2009

My sprite editor

Since my last post I've been creating a sprite editor which allows me to load a sprite sheet and section it off into frames. I can then also anchor points so that animations are drawn smoothly and trigger frames so that when I use the animation in the game I can look out for these triggers and generate an event based on the trigger value. For instance a zero would be a null trigger since the default for all frames is a zero. However a trigger value of one might be the shoot trigger. In which case I could generate bullets whenever this trigger frame is drawn. Instead of having the bullets generated at the beginning of the shoot animation I could have them generated at the exact frame where the gun recoils. Another example would be the jump animation. Let's say we've got a Prince Of Persia-esque character walking along then the player hits the jump button and this begins the jump animation. Now in this version there's a few frames of pre jump action where the character compresses his body then explodes into the jump. It would seem a bit odd to have the character jumping the instant this animation starts so instead I add a trigger frame at frame 4 and the animation is much more convincing. Now this could all be hard coded but the problem with hard coding things like this is that it's much more effort and should the need arise to change the animation then the code would need editing and recompiling, also the code tends to look like crap when there's special case stuff like that dotted all over the place.

No comments:

Post a Comment