Loader 404 Handling

Demonstrates how the loader behaves when assets fail to load due to 404 errors, showing that the game can still proceed to the create state.

Loader 404 Handling, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        //  The URLs are incorrect on purpose to test 404 handling
        this.load.image('taikodrummaster', 'assets/tribbles/taikodrummaster.jpg');
        this.load.image('sukasuka-chtholly', 'assets/tribbles/sukasuka-chtholly.png');
    }

    create ()
    {
        this.add.image(400, 300, 'taikodrummaster');
        this.add.image(400, 500, 'sukasuka-chtholly');

        this.add.text(10, 10, 'Load complete, both files 404d', { font: '16px Courier', fill: '#00ff00' });
    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.AUTO,
    width: 800,
    height: 600,
    parent: 'game-container',
    scene: Example
};

const game = new Phaser.Game(config);

More in Loader12 examples