AdamRyanGameDev Posted April 6, 2018 Share Posted April 6, 2018 I am trying to implement a simple loader with scenes set up with the constructor, as so from the labs.io class MyScene extends Phaser.Scene { constructor (config) { super(config); } preload () { var progress = this.add.graphics(); this.load.on('progress', function (value) { progress.clear(); progress.fillStyle(0xffffff, 1); progress.fillRect(0, 270, 800 * value, 60); }); this.load.on('complete', function () { progress.destroy(); }); this.load.image('face', 'assets/pics/bw-face.png'); } create () { this.face = this.add.image(400, 300, 'face'); } } var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#000000', parent: 'phaser-example', scene: MyScene }; var game = new Phaser.Game(config); Which is basically a cut and paste from the following 2 labs... http://labs.phaser.io/edit.html?src=src\scenes\scene from es6 class.js http://labs.phaser.io/edit.html?src=src\loader\load progress.js How do i get the progress bar? I know that the progress is function is called because I have console logged as it goes from 0.0 to 1.0, but I am having trouble accessing the screen in the preload, (this includes attempts to place a gif and to place text), clearly my Es6 classes knowledge is the problem here, what can i do? Where am I going wrong? Link to comment Share on other sites More sharing options...
samme Posted April 6, 2018 Share Posted April 6, 2018 Remove the destroy call temporarily. Link to comment Share on other sites More sharing options...
AdamRyanGameDev Posted April 6, 2018 Author Share Posted April 6, 2018 Thanks samme! My bad,.... seems to work fine in the labs now. Maybe I was loading too little... apologies! Link to comment Share on other sites More sharing options...
Recommended Posts