Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
                
            
            class Example extends Phaser.Scene { preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.spritesheet('balls', 'assets/sprites/balls.png', { frameWidth: 17, frameHeight: 17 }); } create () { this.input.on('pointermove', function (pointer) { if (pointer.isDown) { this.add.image(pointer.x, pointer.y, 'balls', Phaser.Math.Between(0, 5)); } }, this); } } const config = { type: Phaser.AUTO, parent: 'phaser-example', width: 800, height: 600, scene: Example }; const game = new Phaser.Game(config);
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v385');
        this.load.spritesheet('balls', 'assets/sprites/balls.png', { frameWidth: 17, frameHeight: 17 });
    }
    create ()
    {
        this.input.on('pointermove', function (pointer)
        {
            if (pointer.isDown)
            {
                this.add.image(pointer.x, pointer.y, 'balls', Phaser.Math.Between(0, 5));
            }
        }, this);
    }
}
const config = {
    type: Phaser.AUTO,
    parent: 'phaser-example',
    width: 800,
    height: 600,
    scene: Example
};
const game = new Phaser.Game(config);