Build games as easily as you play them — join the Phaser Beam waitlist for Early Access.
var config = { type: Phaser.WEBGL, width: 800, height: 600, backgroundColor: '#000', parent: 'phaser-example', scene: { preload: preload, create: create } }; var game = new Phaser.Game(config); function preload () { this.load.setBaseURL('https://cdn.phaserfiles.com/v355'); this.load.image('spark', 'assets/particles/blue.png'); } function create () { // First create a particle manager // A single manager can be responsible for multiple emitters // The manager also controls which particle texture is used by _all_ emitter var particles = this.add.particles('spark'); var emitter = particles.createEmitter(); emitter.setPosition(400, 300); emitter.setSpeed(200); emitter.setBlendMode(Phaser.BlendModes.ADD); }
var config = {
type: Phaser.WEBGL,
width: 800,
height: 600,
backgroundColor: '#000',
parent: 'phaser-example',
scene: {
preload: preload,
create: create
}
};
var game = new Phaser.Game(config);
function preload ()
{
this.load.setBaseURL('https://cdn.phaserfiles.com/v355');
this.load.image('spark', 'assets/particles/blue.png');
}
function create ()
{
// First create a particle manager
// A single manager can be responsible for multiple emitters
// The manager also controls which particle texture is used by _all_ emitter
var particles = this.add.particles('spark');
var emitter = particles.createEmitter();
emitter.setPosition(400, 300);
emitter.setSpeed(200);
emitter.setBlendMode(Phaser.BlendModes.ADD);
}