diff --git a/src/gameobjects/particles/Particle.js b/src/gameobjects/particles/Particle.js index 9cb949538..ae1fc2e00 100644 --- a/src/gameobjects/particles/Particle.js +++ b/src/gameobjects/particles/Particle.js @@ -386,12 +386,12 @@ var Particle = new Class({ if (x === undefined) { - this.x += emitter.x.onEmit(this, 'x'); + this.x += emitter._x.onEmit(this, 'x'); } else if (emitter.x.steps > 0) { // EmitterOp is stepped but x was forced (follower?) so use it - this.x += x + emitter.x.onEmit(this, 'x'); + this.x += x + emitter._x.onEmit(this, 'x'); } else { @@ -400,12 +400,12 @@ var Particle = new Class({ if (y === undefined) { - this.y += emitter.y.onEmit(this, 'y'); + this.y += emitter._y.onEmit(this, 'y'); } else if (emitter.y.steps > 0) { // EmitterOp is stepped but y was forced (follower?) so use it - this.y += y + emitter.y.onEmit(this, 'y'); + this.y += y + emitter._y.onEmit(this, 'y'); } else { diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index fabbd8ff1..8073c0de2 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -81,7 +81,6 @@ var configOpMap = [ 'y' ]; - /** * @classdesc * A particle emitter represents a single particle stream. @@ -180,7 +179,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ - this.x = new EmitterOp(config, 'x', 0, true); + this._x = new EmitterOp(config, 'x', 0, true); /** * The y-coordinate of the particle origin (where particles will be emitted). @@ -191,7 +190,7 @@ var ParticleEmitter = new Class({ * @since 3.0.0 * @see Phaser.GameObjects.Particles.ParticleEmitter#setPosition */ - this.y = new EmitterOp(config, 'y', 0, true); + this._y = new EmitterOp(config, 'y', 0, true); /** * A radial emitter will emit particles in all directions between angle min and max, @@ -898,7 +897,14 @@ var ParticleEmitter = new Class({ if (HasValue(config, key)) { - this[key].loadConfig(config); + if (this['_' + key]) + { + this['_' + key].loadConfig(config); + } + else + { + this[key].loadConfig(config); + } } } @@ -1296,8 +1302,8 @@ var ParticleEmitter = new Class({ */ setPosition: function (x, y) { - this.x.onChange(x); - this.y.onChange(y); + this._x.onChange(x); + this._y.onChange(y); return this; }, @@ -2276,6 +2282,48 @@ var ParticleEmitter = new Class({ return a.y - b.y; }, + /** + * + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#x + * @type {number} + * @since 3.0.0 + */ + x: { + + get: function () + { + return this._x.propertyValue; + }, + + set: function (value) + { + this._x.onChange(value); + } + + }, + + /** + * + * + * @name Phaser.GameObjects.Particles.ParticleEmitter#y + * @type {number} + * @since 3.0.0 + */ + y: { + + get: function () + { + return this._y.propertyValue; + }, + + set: function (value) + { + this._y.onChange(value); + } + + }, + /** * Destroys this Particle Emitter and all Particles it owns. *