Particle Emitter Start End Random Range

Demonstrates how to use a range with start, end, and random properties to define initial particle positions.

Particle Emitter Start End Random Range, running
800 × 600
GitHub
class Example extends Phaser.Scene
{
    preload ()
    {
        this.load.setBaseURL('https://cdn.phaserfiles.com/v410');
        this.load.image('bg', 'assets/normal-maps/stones.png');
        this.load.image('gem', 'assets/normal-maps/gem2.png');
    }

    create ()
    {
        this.add.image(400, 300, 'bg');

        this.add.particles(0, 570, 'gem', {
            x: { start: 0, end: 750, random: true },
            scale: 0.5,
            lifespan: 2500,
            gravityY: -200,
            quantity: 2,
            sortProperty: 'y',
            sortOrderAsc: false
        });
    }
}

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

const game = new Phaser.Game(config);

More in Particle Emitter44 examples