How to load Sprite sheets in Runtime ?

Hi All,

I am a new be to Corona, my background is AS3.

Here am going to convert a Flash application to Corona. My animation has more than 1500 frames which need to load in Corona. I tried to use Corona native code with newSpriteMultiSet but it seems to taking too much of texture memory and spent time with level helper API too but it also taking much memory. Here am expecting some help from you people,

  • Is there any way to load Sprite sheets in Runtime ( Load one sprite sheet in a time)
    NB: am using Sprite helper to create sprite sheet

thanks
Jasil
[import]uid: 91692 topic_id: 24943 reply_id: 324943[/import]

Hey, Jasil, I’m wondering if you tried using Spriteloq. It imports SWF files and spits out spritesheets along with image data files in lua format. You should be able to try it for free:

http://www.loqheart.com/spriteloq/

http://developer.anscamobile.com/forums/spriteloq-flash-corona®-exporter

I use Spriteloq and it’s been a lifesaver for me.

Naomi [import]uid: 67217 topic_id: 24943 reply_id: 101298[/import]

hi Naomi,

Thanks for your Quick replay. Am looking to Sprite log,

I need a Suggestion from you,

if i load sprite sheets (image data files), will it be load all files in a time or it will be load one by one

advance thanks

Jasil [import]uid: 91692 topic_id: 24943 reply_id: 101504[/import]

HI Naomi,

Thanks for suggesting Spriteloq

Hope you are much familiar with Spriteloq, Do you have any suggestion to load sprite sheets in Run time or on demand

Thanks
jasil

[import]uid: 91692 topic_id: 24943 reply_id: 101535[/import]

Hey Jasil, it’s hard to give you a concrete solution about this and there isn’t any codes which we can look into. I too have the same problem of my sprites taking too much memory because i tried to load them all at once.

To answer your question: yes you can load spritesheet on runtime but i do my entire level with code and not level helper. You can load them 1 at a time but you will need to dispose the spritesheet when they are no longer in use.

Since you are using level helper i do have a suggestion which might help. Only load those sprites that you absolutely need for that level from level helper and save it out. Suppose for the entire game you have enemy 1, 2, 3 but will only see enemy 1 at level 1 then just load the enemy 1 spritesheet into the level and leave the rest out. Same goes for objects and other stuff. I am not exactly sure how level helper work but i believe they save a level into a lua file which can be used as a module.

Level Helper might also have some options which you didn’t know of or they might allow new level creation so that sprites that are needed can load on that level only. You could go to level helper’s forum to ask around as well.

It isn’t exactly a solution but hope this provides an idea of what to do next. If not, just post more questions and let’s see if we can figure this out. [import]uid: 39846 topic_id: 24943 reply_id: 101553[/import]

Hey Jasil, @ldb.steven’s reply post answered everything, but just in case you’re still wondering, Spriteloq generated spritesheet (just like any spritesheet) can easily be loaded onto a module (such as a game scene/level) where you want it appear. You would then dispose of it when you leave the module, and then load different set of spritesheets (as well as the same one from the previous scene/level) onto the next module.

If you decide to try using Spriteloq and have questions, you can always post Spriteloq specific questions on Spriteloq subforum.

Naomi [import]uid: 67217 topic_id: 24943 reply_id: 101630[/import]