Sign in to follow this  
Kaspian

Unable to load scene

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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.