Here is a (small) guide to SPANIM that includes 3 usages:
GENERAL USAGE
This command is very confusing to many people, but I am sure that's just because of the mini-guide SB gives you. It is very confusing with the instructions. 'ITEM 1: Animation data itself.' How do we do this? I will explain after the general stuff used in all SPANIM commands first.
So in all usages for SPANIM you want your management number of the sprite to influence first. That is a number (0-511) that you associate with sprites when you create them. You would want to create them with SPSET first. Then you want your animation type next. Here are 3 of various different animation types and how to represent them in your code:
- 0 or "XY" - Change the X,Y coordinates of the sprite
- 4 or "R" - Change rotation of the sprite
- 5 or "S" - change the magnification of the sprite
Time 1, Time 2, Time 3... So on up to 32
This is how long it takes to complete each piece of data. This is represented by number of frames. If your number is posotive, it'll jump around. If your number is negative, it'll be smooth. Like, if my number is posotive and I want it to go from one side of the screen to the other, it'll start on one side, then jump to the next suddenly. If it's negative, it'll immediately start moving, and get to its destination by the time I specified has passed. Keep in mind that it keeps an even pace, so you don't have to worry about that.
FOR X,Y COORDINATES
This one confused me. So you have
SPANIM (sprite management number),(0 or "XY"),(Time1) and after Time1 you don't have Time2, you have Item1. For XY coordinates, this is represented as 2 different numbers. X coordinate (for it to be on screen for the whole time, 0-400) and Y coordinate (0-240 for it to be on screen whole time.) You would just do this:
SPANIM MN,AD,T1,X,Y. MN is management number. AD is animation type. T1 is time 1. X is horizontal coordinate. Y is vertical coordinate. You can after item 1 repeat with time2 and data2. You would do it like this:
SPANIM MN,AD,T1,X,Y,T2,X,Y T2 being time 2. Note that this time starts after time one is finished.
Rotation
This is easy. You only need one number for the data, and that's how many degrees it would rotate.
SPANIM MN,AD,T1,R. R is how many degrees to rotate. I like to do -360 to 360. To rotate 360 degrees clockwise in a second:
SPSET 0,0'Make sprite
SPANIM 0,4,-60,360
and counterclockwise:
SPSET 0,0'Make sprite
SPANIM 0,"R",-60,-360
So that's magic.
SCALE
This one is easier than the last one for me. You only have one number, and that's how big it is in comparison to the original sprite size (how big the sprite is with only spset.) So 1 would be the original size, 2 would be double that, 4 would be double 2, and so on. So you would do a simple this if you want it to grow:
SPSET 0,0'Create sprite
SPANIM 0,"S",-60,4
And to jump to a scale:
SPSET 0,0'Create sprite
SPANIM 0,5,60,4
VSYNC 60
Conclusion
That's SPANIM. One last thing, once you have all of your data, you can tack on a number of times to loop. This is optional, but looping can be useful. It is just a number of times you want the animation to repeat itself, and if you want it to repeat itself until you pause it with SPSTOP or destroy the sprite, you can tack on a 0.