Quote: "Ah sweet, this raises another question, can you somehow use animated GIF's in your game as sprites and control there frames?"
When I saw your question I tried to load a .gif and for some reason Darkbasic Pro wouldn't let me load .gifs period (animation or straight image). In the past loading a .gif animation would only show the first frame.
Like Deego I prefer to control the animation myself. What CREATE ANIMATED SPRITE does is make it easier to work with so you don't have to go through all the processes to make an animation work manually. It basically combines all the steps we'd do ourselves in a few commands.
Here's the manual way (using the attached image):
sync rate 0
sync on
hide mouse
` Load the sprite sheet
load bitmap "GrogMegaSprite.png",1
` Set the starting image number
CImage=100
` Grab the images
for x=0 to 460 step 51
get image CImage,x,y,x+50,y+52,1
inc CImage
next x
` Change to the main view screen
set current bitmap 0
` Set the starting image number and timer
CImage=100:tim=timer()
do
` Show the sprite
sprite 1,mousex(),mousey(),CImage
` Check if 100 milliseconds are up
if timer()>tim+100
` Change to the next frame
inc CImage
` Check if the last frame has been shown and reset to first frame
if CImage=110 then CImage=100
` Reset timer
tim=timer()
endif
sync
loop
Here's with CREATE ANIMATED SPRITE instead (using that same image):
sync rate 0
sync on
hide mouse
` Load the sprite sheet into an animated sprite
create animated sprite 1,"GrogMegaSprite.png",10,1,1
do
` Show the sprite
sprite 1,mousex(),mousey(),1
` Play the sprite
play sprite 1,1,10,100
sync
loop
Both code snips show exactly the same results using the same images animating at the same delay. The only difference is obviously the amount of code needed for the same result.
With the manual method we have to load the sprite sheet, grab the 10 images, change the current bitmap to the main screen, manually change what image the sprite uses to animate, and make our own timer for image changing delay.
With CREATE ANIMATED SPRITE it uses a single command to grab all frames in a single image and it's easy to set which frames to play and the delay to use with the PLAY SPRITE command.