Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@georgiee
Created February 25, 2014 15:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save georgiee/9210520 to your computer and use it in GitHub Desktop.
Save georgiee/9210520 to your computer and use it in GitHub Desktop.
Emitter body quickfix 2.0 phaser.js
diff --git a/src/particles/arcade/Emitter.js b/src/particles/arcade/Emitter.js
index e31e59e..7f430ad 100644
--- a/src/particles/arcade/Emitter.js
+++ b/src/particles/arcade/Emitter.js
@@ -286,17 +286,7 @@ Phaser.Particles.Arcade.Emitter.prototype.makeParticles = function (keys, frames
// particle = new this.particleClass(this.game);
// }
- if (collide)
- {
- particle.body.checkCollision.any = true;
- particle.body.checkCollision.none = false;
- }
- else
- {
- particle.body.checkCollision.none = true;
- }
-
- particle.body.collideWorldBounds = collideWorldBounds;
+
particle.exists = false;
particle.visible = false;
@@ -395,9 +385,12 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
particle.reset(this.emitX, this.emitY);
}
+ particle.physicsEnabled = true
particle.lifespan = this.lifespan;
+ particle.body.kinematic = true;
+ particle.body.mass = 4;
- particle.body.bounce.setTo(this.bounce.x, this.bounce.y);
+ //particle.body.bounce.setTo(this.bounce.x, this.bounce.y);
if (this.minParticleSpeed.x != this.maxParticleSpeed.x)
{
@@ -421,11 +414,12 @@ Phaser.Particles.Arcade.Emitter.prototype.emitParticle = function () {
if (this.minRotation != this.maxRotation)
{
- particle.body.angularVelocity = this.game.rnd.integerInRange(this.minRotation, this.maxRotation);
+ speed = this.game.rnd.integerInRange(this.minRotation, this.maxRotation);
+ particle.body.angularVelocity = this.game.math.px2p(speed);
}
else
{
- particle.body.angularVelocity = this.minRotation;
+ particle.body.angularVelocity = this.game.math.px2p(this.minRotation);
}
if (this.minParticleScale !== 1 || this.maxParticleScale !== 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment