Multi-Line Bitmap Text

Learn how to display multiple lines of text within a single BitmapText object using newline characters.

Multi-Line Bitmap Text, running
1024 × 768
GitHub
class Example extends Phaser.Scene
{
    constructor ()
    {
        super();
    }

    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.bitmapFont('desyrel', 'assets/fonts/bitmap/desyrel.png', 'assets/fonts/bitmap/desyrel.xml');
    }

    create ()
    {
        const dynamic1 = this.add.bitmapText(0, 0, 'desyrel', 'welcome to the jungle\nwe got fun and games');
    }
}

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

const game = new Phaser.Game(config);

More in Static24 examples