From ce752d356768faf014aa938198808a7ce19a37c5 Mon Sep 17 00:00:00 2001 From: Johannes Wiese Date: Sat, 3 Dec 2016 12:51:55 +0100 Subject: [PATCH] change emitter.gravity from number to Phaser.Point This allows the emitter to set x- and y-axis gravity for each particle, not only the y-axis. --- v2-community/src/particles/arcade/Emitter.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/v2-community/src/particles/arcade/Emitter.js b/v2-community/src/particles/arcade/Emitter.js index c3584df4c..83c6f1819 100755 --- a/v2-community/src/particles/arcade/Emitter.js +++ b/v2-community/src/particles/arcade/Emitter.js @@ -115,10 +115,10 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) { this.alphaData = null; /** - * @property {number} gravity - Sets the `body.gravity.y` of each particle sprite to this value on launch. + * @property {Phaser.Point} gravity - Sets the `body.gravity` of each particle sprite to this on launch. * @default */ - this.gravity = 100; + this.gravity = new Phaser.Point(0, 100); /** * @property {any} particleClass - For emitting your own particle class types. They must extend Phaser.Particle. @@ -675,7 +675,7 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function (x, y, key, fr body.velocity.y = rnd.between(this.minParticleSpeed.y, this.maxParticleSpeed.y); body.angularVelocity = rnd.between(this.minRotation, this.maxRotation); - body.gravity.y = this.gravity; + body.gravity = this.gravity; body.angularDrag = this.angularDrag; particle.onEmit();