When you save your multi-frame sprite with command SPRITE SAVE it is automatically saved as sprite sheet.
In samples folder there will be an example "sprite creator.txt" which generates a set of single-frame sprites, shows them, then creates multi-frame sprite from them, plays it, saves it as sprite sheet, shows this sprite sheet, loads it as multi-frame sprite, and plays second sprite also (in a shuttle way ).
This is the text of the sample "sprite creator.txt":
Code: Select all
' creates N sprites and shows them
' creates animated sprite "a" from these sprites and shows LOOP animation
' saves these sprites as spritesheet and shows this image
' reads this spritesheet back to animated sprite "b" and shows SWAY animation
' NOTE: if you change N then to set proper NX and NY you need to know how spritesheet is created
graphics
n=10 ' number of sprites
nx=5 ' spritesheet X count
ny=2 ' spritesheet Y count
' creates N sprites
draw font size 40
draw color 0,0,1
for i=1 to n
sprite i begin 50,50
draw rect 0,0 to 50,50
draw text i at 0,5
sprite i end
sprite i at 60*(i-1),50
sprite i show
next i
draw font size 30
draw color .8,.8,.8
draw text "Sprites:" at 10,10
' creates animated sprite "a" from sprites
sprite 1 copy "a"
for i=2 to n
sprite "a" add i
next i
' shows animated sprite "a"
draw text "A:" at 10,130
sprite "a" at 60,120
sprite "a" show
sprite "a" delay 0.3
sprite "a" loop
' saves animated sprite as spritesheet
f$="test"&n&".png"
sprite "a" save f$
' shows spritesheet
draw text "Spritesheet:" at 10,190
draw image f$ at 0,230
' loads spritesheet as animated sprite "b"
sprite "b" load f$,nx,ny
' shows animated sprite "b"
draw text "B:" at 130,130
sprite "b" at 180,120
sprite "b" show
sprite "b" delay 0.3
sprite "b" sway
end: goto end