mirror of
https://github.com/photonstorm/phaser
synced 2024-11-23 21:24:09 +00:00
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.
This commit is contained in:
parent
1afa75d871
commit
ce752d3567
1 changed files with 3 additions and 3 deletions
|
@ -115,10 +115,10 @@ Phaser.Particles.Arcade.Emitter = function (game, x, y, maxParticles) {
|
||||||
this.alphaData = null;
|
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
|
* @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.
|
* @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.velocity.y = rnd.between(this.minParticleSpeed.y, this.maxParticleSpeed.y);
|
||||||
body.angularVelocity = rnd.between(this.minRotation, this.maxRotation);
|
body.angularVelocity = rnd.between(this.minRotation, this.maxRotation);
|
||||||
|
|
||||||
body.gravity.y = this.gravity;
|
body.gravity = this.gravity;
|
||||||
body.angularDrag = this.angularDrag;
|
body.angularDrag = this.angularDrag;
|
||||||
|
|
||||||
particle.onEmit();
|
particle.onEmit();
|
||||||
|
|
Loading…
Reference in a new issue