Percentage of composer loading?

Hello everyone

In my game I mainly 2 scenes, menu and game. Sometimes the game scene is quite large so I would like to show an intermediate stage that shows an upload. I wish this scene is only shown the necessary time so that the user deva see this scene as quickly as possible. The question then is how do I do this? I think I should ricavere the progress of loading a scene or something

it can be done? In many games a real loading bar is even shown …

no idea?

You could split the loading of your scene objects into chunks or do them one at a time. Use an enterFrame listener to keep track of what to load next, call the appropriate function, and at the same update update your progress bar depending on how many objects loaded vs the total to be done.

Thank you @nick_sherman

But that it is not possible using the composer. Or at least you can doing many changed to different. I wanted something that worked invoking “composer.loadScene ()” or similar. there is no such thing?

Nothing is built in, no. But it’s easy enough to create your own loading routine. It does improve the user experience so worth the effort.

Ask an example of how to create a loading routine would be too? 

with these parts of the code are not practical in the Corona and I would avoid making mistakes…

Why don’t you call composer.loadScene() as soon as the menu scene loads (in it’s scene:show() “did” phase)? That way the scene is loading while the user is first looking at the menu. If you think they can hit the play button too quickly, use a transition and fade the buttons in.

Rob

Mine is a game with different levels can not charge the gamescene until I do not know what level the user has selected.

This is why I thought of a loading scene. I could give her a hard time, but I would like the waiting time to adjust to the scene that I have to load

What you will need is coroutines as this enables your app to split intensive processing into chunks.  Some info here - https://coronalabs.com/blog/2015/02/10/tutorial-using-coroutines-in-corona/

Unfortunately Corona is single threaded so if your app runs a function to say load 100 images and that takes 5 secs then your app will hang for 5 secs.  What you need to do is split the loading into 20 lots of 5 images and then you can update a progress bar on each frame.

Thank you @adrianm

You gave me a great alternative.

Sure it’s a little cumbersome but it is definitely a good idea

no idea?

You could split the loading of your scene objects into chunks or do them one at a time. Use an enterFrame listener to keep track of what to load next, call the appropriate function, and at the same update update your progress bar depending on how many objects loaded vs the total to be done.

Thank you @nick_sherman

But that it is not possible using the composer. Or at least you can doing many changed to different. I wanted something that worked invoking “composer.loadScene ()” or similar. there is no such thing?

Nothing is built in, no. But it’s easy enough to create your own loading routine. It does improve the user experience so worth the effort.

Ask an example of how to create a loading routine would be too? 

with these parts of the code are not practical in the Corona and I would avoid making mistakes…

Why don’t you call composer.loadScene() as soon as the menu scene loads (in it’s scene:show() “did” phase)? That way the scene is loading while the user is first looking at the menu. If you think they can hit the play button too quickly, use a transition and fade the buttons in.

Rob

Mine is a game with different levels can not charge the gamescene until I do not know what level the user has selected.

This is why I thought of a loading scene. I could give her a hard time, but I would like the waiting time to adjust to the scene that I have to load

What you will need is coroutines as this enables your app to split intensive processing into chunks.  Some info here - https://coronalabs.com/blog/2015/02/10/tutorial-using-coroutines-in-corona/

Unfortunately Corona is single threaded so if your app runs a function to say load 100 images and that takes 5 secs then your app will hang for 5 secs.  What you need to do is split the loading into 20 lots of 5 images and then you can update a progress bar on each frame.

Thank you @adrianm

You gave me a great alternative.

Sure it’s a little cumbersome but it is definitely a good idea