Emojis in Text

Demonstrates how to render emojis within a Text Game Object using emoji characters directly or Unicode escape sequences.

Emojis in Text, running
800 ร— 600
GitHub
class Example extends Phaser.Scene
{
    create ()
    {
        //  How this renders depends entirely on the browser, each does it a little differently
        //  Note that the fill color value is ignored for most emoji (as you'd expect)
        this.add.text(0, 60, '๐Ÿ˜œ๐Ÿฉ๐Ÿ„๐Ÿ•น๐Ÿ’–๐ŸงŸ', { fontFamily: 'Arial', fontSize: 96, fill: '#ff0000' });
        this.add.text(0, 260, '๐Ÿฅช๐Ÿคฌ๐Ÿง ๐Ÿ’ฉ๐Ÿค–๐Ÿ‘ฉโ€๐Ÿ’ป', { fontFamily: 'Arial', fontSize: 96, fill: '#ff0000' });

        //  Here is how to embed an emoji using a unicode sequence instead:
        //  For more details see http://crocodillon.com/blog/parsing-emoji-unicode-in-javascript
        this.add.text(0, 460, '\ud83d\ude03', { fontFamily: 'Arial', fontSize: 96, fill: '#ff0000' });
    }
}

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 Text29 examples