var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#000', parent: 'phaser-example', scene: { preload: preload, create: create, update: update } }; var particles; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json'); } function create () { // this.cameras.main.setAlpha(0.4); particles = this.add.particles('flares'); particles.createEmitter({ frame: 'blue', x: -100, y: 0, lifespan: 2000, speed: { min: 400, max: 600 }, angle: 330, gravityY: 300, scale: { start: 0.4, end: 0 }, quantity: 2, blendMode: 'ADD' }); particles.createEmitter({ frame: 'red', x: 100, y: 0, lifespan: 2000, speed: { min: 400, max: 600 }, angle: 330, gravityY: 300, scale: { start: 0.4, end: 0 }, quantity: 2, blendMode: 'ADD' }); particles.setPosition(400, 300); } function update () { particles.rotation -= 0.01; }
Scan to open on your mobile device
var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#000', parent: 'phaser-example', scene: { preload: preload, create: create, update: update } }; var particles; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.atlas('flares', 'assets/particles/flares.png', 'assets/particles/flares.json'); } function create () { // this.cameras.main.setAlpha(0.4); particles = this.add.particles('flares'); particles.createEmitter({ frame: 'blue', x: -100, y: 0, lifespan: 2000, speed: { min: 400, max: 600 }, angle: 330, gravityY: 300, scale: { start: 0.4, end: 0 }, quantity: 2, blendMode: 'ADD' }); particles.createEmitter({ frame: 'red', x: 100, y: 0, lifespan: 2000, speed: { min: 400, max: 600 }, angle: 330, gravityY: 300, scale: { start: 0.4, end: 0 }, quantity: 2, blendMode: 'ADD' }); particles.setPosition(400, 300); } function update () { particles.rotation -= 0.01; }