Jump to content

Combine SceneLoader with Es6 Scenes


Recommended Posts

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)

    preload ()

        var progress = this.add.graphics();
        this.load.on('progress', function (value) {
            progress.fillStyle(0xffffff, 1);
            progress.fillRect(0, 270, 800 * value, 60);


        this.load.on('complete', function () {



        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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...