Jump to content

Unable to load scene


Kaspian
 Share

Recommended Posts

Hey all. Just getting my head around phaser and so far so good. Except, I can't get my TitleScene to load. It's all pretty basic at the moment, but demonstrates my issue. Maybe I'm missing something obvious but I can't find many resources for 3.

I can get my code to load on Facebook Instant. I am not using the instant library as I had issue with it. After the game has loaded I get no console logs.

main.js

import { TitleScene } from './scene/TitleScene'

let game
const config = {
    type: Phaser.AUTO,
    width: window.innerWidth,
    height: window.innerHeight,
    scene: {
        preload,
        create,
        TitleScene
    }
}

FBInstant
    .initializeAsync()
    .then(function() {
        game = new Phaser.Game(config)
    })

function preload() {
    FBInstant.setLoadingProgress(100)
}

function create() {
    FBInstant
        .startGameAsync()
        .then(function() {
            const playerName = FBInstant.player.getName()
            game.scene.launch('TitleScene')
        })
}

scene/TitleScene.js


export class TitleScene extends Phaser.Scene {
    constructor() {
        super({ key: 'TitleScene' })
        console.log('TitleScene#constructor')
    }

    init() {
        console.log('TitleScene#init')
    }
    
    preload() {
        console.log('TitleScene#preload')
    }
    
    create() {
        console.log('TitleScene#create')
    }
    
    update() {
        console.log('TitleScene#update')
    }
}

Thanks all.

Link to comment
Share on other sites

 Share

  • Recently Browsing   0 members

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