@ Tom0001:
It's just a quick example of how changing the image number but keeping the same sprite works. All he really needs from that code snip is the SPRITE command with the image number as a variable.
@ BobMarilyn:
Lets say you use TImage for the current image number of the tank sprite. When you draw that tank use only one SPRITE command and just change the variable TImage when you want to replace that normal looking tank to the blown up tank (SPRITE 1,PlayerX,PlayerY,TImage).
Image numbers:
1 = Normal Tank
2 = Blown Up Tank
3-10 = Explosion
How to order it:
1. TImage=1 (shows normal tank)
2. Show explosion animation (using a different sprite than the tank)
3. TImage=2 (shows blown up tank)
4. Move explosion sprite off screen
@ Everybody:
I felt I should add the new method for animating since I mentioned the other snip was the old method but mainly because it's much better and more efficient. It only uses one image rather than however many you need for all the frames and we don't have to grab them manually and make our own timer.
This does exactly the same thing as my previous code snip:
` Make sync rate as fast as the computer can handle it
sync rate 0
` Turn on syncing
sync on
` Hide the mouse
hide mouse
` Load the sprite sheet into an animated sprite (10 frames across, 1 down)
create animated sprite 1,"GrogMegaSprite.png",10,1,1
do
` Show the sprite
sprite 1,mousex(),mousey(),1
` Play the sprite (show frames 1 to 10 changing every 100 milliseconds)
play sprite 1,1,10,100
` Update the screen
sync
loop