diff --git a/v3/src/gameobjects/particles/ParticleEmitter.js b/v3/src/gameobjects/particles/ParticleEmitter.js index 40171a214..3936375a1 100644 --- a/v3/src/gameobjects/particles/ParticleEmitter.js +++ b/v3/src/gameobjects/particles/ParticleEmitter.js @@ -606,7 +606,7 @@ var ParticleEmitter = new Class({ { // Where source = Geom like Circle, or a Path or Curve // emitZone: { type: 'random', source: X } - // emitZone: { type: 'edge', source: X, quantity: 32, [stepRate=0], [yoyo=false] } + // emitZone: { type: 'edge', source: X, quantity: 32, [stepRate=0], [yoyo=false], [seamless=true] } var type = GetFastValue(zoneConfig, 'type', 'random'); var source = GetFastValue(zoneConfig, 'source', null); @@ -616,14 +616,20 @@ var ParticleEmitter = new Class({ switch (type) { case 'random': + this.emitZone = new RandomZone(source); + break; case 'edge': + var quantity = GetFastValue(zoneConfig, 'quantity', 1); var stepRate = GetFastValue(zoneConfig, 'stepRate', 0); var yoyo = GetFastValue(zoneConfig, 'yoyo', false); - this.emitZone = new EdgeZone(source, quantity, stepRate, yoyo); + var seamless = GetFastValue(zoneConfig, 'seamless', true); + + this.emitZone = new EdgeZone(source, quantity, stepRate, yoyo, seamless); + break; } } diff --git a/v3/src/gameobjects/particles/zones/RandomZone.js b/v3/src/gameobjects/particles/zones/RandomZone.js index 28ab51d0e..a2fd4e7e9 100644 --- a/v3/src/gameobjects/particles/zones/RandomZone.js +++ b/v3/src/gameobjects/particles/zones/RandomZone.js @@ -1,4 +1,5 @@ var Class = require('../../../utils/Class'); +var Vector2 = require('../../../math/Vector2'); var RandomZone = new Class({ @@ -7,11 +8,18 @@ var RandomZone = new Class({ function RandomZone (source) { this.source = source; + + this._tempVec = new Vector2(); }, getPoint: function (particle) { - this.source.getRandomPoint(particle); + var vec = this._tempVec; + + this.source.getRandomPoint(vec); + + particle.x = vec.x; + particle.y = vec.y; } });