Page 1 of 1
Posted: Wed Sep 04, 2002 7:07 pm
by BackupUser
Restored from previous forum. Originally posted by Tomio.
I want to load a great number of sprites (20 - 40).
Small in size, so there is no problem with memory.
Only a few will be displayed at the same time.
But to save time I need to load the sprites prior.
All the sprites have the same dimension.
Is there a way to have all the sprites packed together in one datafile, load this and install/extract/expand the sprites instead of doing 20-40 LoadSprite commands?
Thank you for help../Tomio
Posted: Wed Sep 04, 2002 7:15 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Hi,
i think a combo with the packer library and the CatchSprite() command should do the trick, check out those and if you're still uncertain after reading about them and looking at the examples that go with the packer Lib, well just say so and we'll try to help further.
Posted: Thu Sep 05, 2002 7:53 pm
by BackupUser
Restored from previous forum. Originally posted by Tomio.
Hello Pupil,
I was thinking about packing sprites into one file but couldn't combine things together. With your hint I think the way could be like this:
;Create the packed sprites (in a separate program):
CreatePack("PackedSprites")
Loop through list of BMP sprite files 1..20:
AddPackFile
EndLoop
ClosePack
;load the sprites 1...20:
OpenPack("PackedSprites")
Loop through the content 1...20:
Mem=NextPackFile ;but where do data go? Mem?
CatchSprite(i,Mem) ;??? OK?
EndLoop
ClosePack
Hmm, seems too simple. What do you mean?
../tomio
tomio
Posted: Thu Sep 05, 2002 8:38 pm
by BackupUser
Restored from previous forum. Originally posted by Pupil.
Originally posted by Tomio
Hmm, seems too simple. What do you mean?
It is simple, your pseudo code was completely right.. If you do it like that you'll get it to work, give it a try! If you run into trouble i'll try to post a working example..
Oh, one small hint -use 'if CreatePack(...' and 'if OpenPack(..' so you don't try to perform action on a non-opened file.
Just one more hint, i think you have to open a screen before you can load sprites(or catch sprites).
Good luck.
Posted: Thu Sep 05, 2002 10:29 pm
by BackupUser
Restored from previous forum. Originally posted by merendo.
You could also create one big image (TileMap) and draw all the small images in the big one and cut them out using ClipSprite()
Cu @ll, merendo
--
I've been hiding - What am I hiding from???
Posted: Fri Sep 06, 2002 10:07 pm
by BackupUser
Restored from previous forum. Originally posted by Tomio.
Well,
I've programmed the pseudo code of my forgoing email and, yes, it works. Once again I'm impressed how easy it is to program rather complicated processes with a few lines in PB.
I found that "Mem=NextPackFile()" gives Mem=0 at the end of the file. So you can use this to read in all sprites without knowing the number in advance.
Merendo, the idea with the big image would make thinks even more simple. But one point: I want to replace some of the sprites from time to time. Than it's more comfortable to use CreatePack.
Again thanks for help.../tomio
tomio