Sprite Sheet

Load a sprite sheet with defined frame dimensions and display individual frames using their index.

Sprite Sheet, running
1024 × 768
GitHub
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');

        this.load.spritesheet('diamonds', 'assets/sprites/diamonds32x24x5.png', { frameWidth: 32, frameHeight: 24 });

    }

    create ()
    {

        this.add.image(0, 0, 'diamonds', 0);
        this.add.image(64, 0, 'diamonds', 1);
        this.add.image(128, 0, 'diamonds', 2);
        this.add.image(32, 32, 'diamonds', 3);
        this.add.image(96, 32, 'diamonds', 4);

    }
}

const config = {
    scale: { mode: Phaser.Scale.FIT },
    type: Phaser.WEBGL,
    parent: 'game-container',
    scene: Example
};

const game = new Phaser.Game(config);

More in Textures36 examples