Hi,
I don’t want to load all the graphic assets from the beginning. instead of that, load the necessary assets before every stage. for example when playing stage 1, load the resources for stage 2 in the background.
Thanks jake,
But when we load assets of current scene it hold on black screen initially and then load images in create function.I want to load assets of next state in a background of current state.
Let’s assume you have Scene A, which will have to act as your initial preloader and will contain very minimal assets to ensure a quick loading time. Once loaded, in the create method of Scene A, you can load all of the assets for Scene B like so:
this.load.image('sceneBstuff', 'assets/pics/ra-einstein.png');
this.load.on('complete', ()=>{
//ENABLE ABILITY TO GO TO SCENE B
});
this.load.start();
Note: If your game isn’t huge, I would suggest just creating a preload scene and loading all of the assets for your game there. The preload scene could simply have a progress bar to indicate when the assets have loaded and then progress you to your first scene and you won’t have to worry about preloading anything afterwards.