class Example extends Phaser.Scene { preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json'); } create () { const emitter = this.add.particles(400, 250, 'flares', { frame: [ 'red', 'yellow', 'green' ], lifespan: 4000, speed: { min: 150, max: 250 }, scale: { start: 0.8, end: 0 }, gravityY: 150, blendMode: 'ADD', emitting: false }); this.input.on('pointerdown', pointer => { emitter.explode(16); }); this.add.text(10, 10, 'Click to explode emit particles'); } } const config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000', parent: 'phaser-example', scene: Example }; const game = new Phaser.Game(config);
Scan to open on your mobile device
class Example extends Phaser.Scene { preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v385'); this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json'); } create () { const emitter = this.add.particles(400, 250, 'flares', { frame: [ 'red', 'yellow', 'green' ], lifespan: 4000, speed: { min: 150, max: 250 }, scale: { start: 0.8, end: 0 }, gravityY: 150, blendMode: 'ADD', emitting: false }); this.input.on('pointerdown', pointer => { emitter.explode(16); }); this.add.text(10, 10, 'Click to explode emit particles'); } } const config = { type: Phaser.AUTO, width: 800, height: 600, backgroundColor: '#000', parent: 'phaser-example', scene: Example }; const game = new Phaser.Game(config);