pixijs / particle-emitter

A particle system for PixiJS
http://pixijs.io/particle-emitter/docs
MIT License
799 stars 127 forks source link

autoUpdate incorrectly set to true on playOnce and playOnceAndDestroy #79

Closed KidScripty closed 6 years ago

KidScripty commented 6 years ago

I would still like to use these methods, but utilise my own update function while doing so. I don't think autoUpdate should be set to true inside these functions. autoUpdate should be specified as true in the constructor configuration argument only

KidScripty commented 6 years ago

https://github.com/pixijs/pixi-particles/blob/master/src/Emitter.js line 797

p.playOnceAndDestroy = function(callback) { this.autoUpdate = true; this.emit = true; this._destroyWhenComplete = true; this._completeCallback = callback; };

p.playOnce = function(callback) { this.autoUpdate = true; this.emit = true; this._completeCallback = callback; };

andrewstart commented 6 years ago

autoUpdate is the primary point of these methods. If you wish to tick the emitters yourself, you just need to set emit = true to start the emitter.

KidScripty commented 6 years ago

If I want to use theplayOnceAndDestroy andplayOnce methods without using the internal particles ticker, (i.e. respect the original choice I made, not to use internal autoUpdate when I instantiated the emitter), then I must manually set autoUpdate to false after calling these methods? Are these methods not designed to work with my own ticker?

andrewstart commented 6 years ago

Yes, setting autoUpdate to false after calling one of those methods, or setting _completeCallback instead of using them, would be a workaround. These methods are designed to use only the ticker built into PIXI. While an autoUpdate value is now supported in the config, changing the behavior of these two methods would be a breaking change, and would have to wait until a 3.0.0 version of the library (with any other major changes I would want to do).

andrewstart commented 6 years ago

Added in version 3