Hi,
Simple loading bar use load image after on progress, on fileprogress, and on complete :
this.load.on('progress', this.onProgress, this);
this.load.on('fileprogress', this.onFileProgress, this);
this.load.on('complete', this.onComplete, this);
this.load.image('aqua_ball');
https://phaser.io/examples/v3/view/loader/game-load-config
But, when we use scene files payload, how we can get callback for progress, fileprogress, and complete to build loading bar same like the example above?
const bootScene = new Phaser.Class({
Extends: Phaser.Scene,
initialize:
function bootScene ()
{
Phaser.Scene.call(this, { key: 'boot',
pack: {
files: [
{ type: 'image', key: 'aqua_ball', url: 'aqua_ball.png' },
]
}
});
},
init: function (data) {
...
},
preload: function () {
// progress loading bar?
this.load.on('progress', this.onProgress, this);
this.load.on('fileprogress', this.onFileProgress, this);
this.load.on('complete', this.onComplete, this);
},
create: function (data) {
...
},
});