Making a loading screen

Hi,

I have a section of my game where I unload the menu screens and load the level (when the level is selected).

I have tried to put a rect onscreen before the unload/load, then remove it afterwards, but it doesn’t show at runtime - how do you do this “properly”?

P.S. Want to add a spinner widget too…

Thanks,

Nathan.

Hi guys - any ideas on this one?

Thanks,

Nathan.

Your question is a bit vague.  Are you using a scene manager like Storyboard or Director or are you managing your own scenes? 

For simplicity you could use use native.setActivityIndicator() to show a greyed out spinner showing that your app is busy.

http://docs.coronalabs.com/api/library/native/setActivityIndicator.html

I’m not using a scene manager - first I’ve heard of the concept.

I ran into a problem where I was holding too many images in memory - hitting the limit on older devices.

Apart from my image & sprite sheet optimisation, I also started more closely managing the load/unload of my images. I have a stack of images loaded (in a display group) for the main menu, when the user selects a level, I remove the whole display group and load up a new group with all of the level images, then start the level. I do the same in reverse coming back out.

I tried a simple…

create a full screen rect

objMainMenu:removeSelf()

objMainMenu = nil

createLevel(x)

hide full screen rect

But it just doesn’t show the rect - it freezes on the last shown frame of the main menu, then the action starts again when the level starts.

Should this approach work, or am I coming at it from the wrong angle?

Nathan.

In my experience you need to give it a few milliseconds to give it time to properly display the loading screen before starting the create level proccesss.

Something like:

Show-load-screen

timer.performWithDelay(100, functionThatLoadsNextLevel)

perhaps it being displayed behind other images

Nah - it’s on top - the 100ms delay has made it happen!

Thanks,

Nathan.

Hi guys - any ideas on this one?

Thanks,

Nathan.

Your question is a bit vague.  Are you using a scene manager like Storyboard or Director or are you managing your own scenes? 

For simplicity you could use use native.setActivityIndicator() to show a greyed out spinner showing that your app is busy.

http://docs.coronalabs.com/api/library/native/setActivityIndicator.html

I’m not using a scene manager - first I’ve heard of the concept.

I ran into a problem where I was holding too many images in memory - hitting the limit on older devices.

Apart from my image & sprite sheet optimisation, I also started more closely managing the load/unload of my images. I have a stack of images loaded (in a display group) for the main menu, when the user selects a level, I remove the whole display group and load up a new group with all of the level images, then start the level. I do the same in reverse coming back out.

I tried a simple…

create a full screen rect

objMainMenu:removeSelf()

objMainMenu = nil

createLevel(x)

hide full screen rect

But it just doesn’t show the rect - it freezes on the last shown frame of the main menu, then the action starts again when the level starts.

Should this approach work, or am I coming at it from the wrong angle?

Nathan.

In my experience you need to give it a few milliseconds to give it time to properly display the loading screen before starting the create level proccesss.

Something like:

Show-load-screen

timer.performWithDelay(100, functionThatLoadsNextLevel)

perhaps it being displayed behind other images

Nah - it’s on top - the 100ms delay has made it happen!

Thanks,

Nathan.