From 530c7a3d9225610fcf1039868cb305c20b5c0666 Mon Sep 17 00:00:00 2001 From: Vladislav Forsh Date: Mon, 21 Sep 2020 12:06:49 +0300 Subject: [PATCH 1/2] Add reserve property to particle emitter config --- src/gameobjects/particles/ParticleEmitter.js | 5 +++++ src/gameobjects/particles/typedefs/ParticleEmitterConfig.js | 1 + 2 files changed, 6 insertions(+) diff --git a/src/gameobjects/particles/ParticleEmitter.js b/src/gameobjects/particles/ParticleEmitter.js index 1dcdc0a34..3b7b45979 100644 --- a/src/gameobjects/particles/ParticleEmitter.js +++ b/src/gameobjects/particles/ParticleEmitter.js @@ -863,6 +863,11 @@ var ParticleEmitter = new Class({ this.setFrame(config.frame); } + if (HasValue(config, "reserve")) + { + this.reserve(config.reserve); + } + return this; }, diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js index c1e176e5b..f7fca1e56 100644 --- a/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js +++ b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js @@ -54,4 +54,5 @@ * @property {number} [followOffset.x] - x-coordinate of the offset. * @property {number} [followOffset.y] - y-coordinate of the offset. * @property {number|number[]|string|string[]|Phaser.Textures.Frame|Phaser.Textures.Frame[]|Phaser.Types.GameObjects.Particles.ParticleEmitterFrameConfig} [frame] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#frames}. + * @property {integer} [reserve] - Creates specified number of inactive particles and adds them to this emitter's pool. {@link Phaser.GameObjects.Particles.ParticleEmitter#reserve} */ From 4d7301a4bececa6773911793e50104107bc74420 Mon Sep 17 00:00:00 2001 From: Vladislav Forsh Date: Mon, 21 Sep 2020 12:38:29 +0300 Subject: [PATCH 2/2] Improve types for particle emitter deathZone and emitZone --- src/gameobjects/particles/typedefs/ParticleEmitterConfig.js | 3 ++- src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js index f7fca1e56..50cea2d3f 100644 --- a/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js +++ b/src/gameobjects/particles/typedefs/ParticleEmitterConfig.js @@ -48,7 +48,8 @@ * @property {(Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType|Phaser.Types.GameObjects.Particles.EmitterOpOnUpdateType)} [tint] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#tint}. * @property {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [x] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#x} (emit only). * @property {Phaser.Types.GameObjects.Particles.EmitterOpOnEmitType} [y] - Sets {@link Phaser.GameObjects.Particles.ParticleEmitter#y} (emit only). - * @property {object} [emitZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. + * @property {Phaser.Types.GameObjects.Particles.ParticleEmitterEdgeZoneConfig | Phaser.Types.GameObjects.Particles.ParticleEmitterRandomZoneConfig} [emitZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setEmitZone}. + * @property {Phaser.Types.GameObjects.Particles.ParticleEmitterDeathZoneConfig} [deathZone] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setDeathZone}. * @property {Phaser.Types.GameObjects.Particles.ParticleEmitterBounds|Phaser.Types.GameObjects.Particles.ParticleEmitterBoundsAlt} [bounds] - As {@link Phaser.GameObjects.Particles.ParticleEmitter#setBounds}. * @property {object} [followOffset] - Assigns to {@link Phaser.GameObjects.Particles.ParticleEmitter#followOffset}. * @property {number} [followOffset.x] - x-coordinate of the offset. diff --git a/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js b/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js index c9823d736..123d88ef9 100644 --- a/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js +++ b/src/gameobjects/particles/typedefs/RandomZoneSourceCallback.js @@ -2,5 +2,5 @@ * @callback Phaser.Types.GameObjects.Particles.RandomZoneSourceCallback * @since 3.0.0 * - * @param {Phaser.Math.Vector2} point - A point to modify. + * @param {Phaser.Math.Vector2Like} point - A point to modify. */