Skip to content

Instantly share code, notes, and snippets.

Created May 9, 2014 10:35
Show Gist options
  • Save anonymous/39aa102bd2ccf3b29670 to your computer and use it in GitHub Desktop.
Save anonymous/39aa102bd2ccf3b29670 to your computer and use it in GitHub Desktop.
Phaser.Particles.Arcade.Emitter.prototype.paused = false;
Phaser.Particles.Arcade.Emitter.prototype.setPaused = function(val){
if(val == this.paused){
}else{
this.paused = val;
var i = this.children.length;
while (i--)
{
this.children[i].body.moves = !val;
}
}
}
Phaser.Particles.Arcade.Emitter.prototype.update = function () {
if (this.paused)return;
if (this.on)
{
if (this._explode)
{
this._counter = 0;
do
{
this.emitParticle();
this._counter++;
}
while (this._counter < this._quantity);
this.on = false;
}
else
{
if (this.game.time.now >= this._timer)
{
this.emitParticle();
this._counter++;
if (this._quantity > 0)
{
if (this._counter >= this._quantity)
{
this.on = false;
}
}
this._timer = this.game.time.now + this.frequency;
}
}
}
var i = this.children.length;
while (i--)
{
if (this.children[i].exists)
{
this.children[i].update();
}
}
};
Phaser.Particle.prototype.preUpdate = function() {
if(this.parent.paused){
return;
}
Phaser.Sprite.prototype.preUpdate.call(this);
}
Phaser.Particles.Arcade.Emitter.prototype = Phaser.Particles.Arcade.Emitter.prototype;
@verybluebot
Copy link

this is amazing, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment