Closed KidScripty closed 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; };
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.
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?
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).
Added in version 3
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