pixijs / particle-emitter

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

misleading "emitterLifetime" #132

Closed serglider closed 4 years ago

serglider commented 4 years ago

Hello guys, Thank you for your great job on this wonderful piece of software.

Because of this line https://github.com/pixijs/pixi-particles/blob/73ac3c94d7e579f02648c50133c31b2b5307e7f6/src/Emitter.ts#L826

the emitter will emit infinitely if you set "emitterLifetime" to zero. So the docs are misleading here https://github.com/pixijs/pixi-particles/blob/526bf74dd598f1b260ad9397fb3a0f8832dd4ed7/src/Emitter.ts#L160

It can be fixed by if(this._emitterLife >= 0)

Should I create a PR?

Thanks

andrewstart commented 4 years ago

Yes, please. Otherwise that could be an incredibly rare edge case where an emitter hits a remaining life of 0 and emits forever. It has been a long time since I wrote that bit, but I am fairly certain it is an oversight rather than allowing for one las emission.

andrewstart commented 4 years ago

Fixed by #133