kaplayjs / kaplay

🦖 A JavaScript/TypeScript Game Library that feels like a game, fun
https://kaplayjs.com
MIT License
575 stars 41 forks source link

bug: particles() component's emit() function errors after a particle's lifespan has been expired. #450

Closed tristanperrow closed 1 month ago

tristanperrow commented 1 month ago

Describe the bug

When running .emit() after one of the particle's emitted from the emitter's lifespan has been expired, it produces an error.

Version

4000.0.0-alpha.5

To Reproduce

Steps to reproduce the behavior:

  1. Add the particles() component to a game object
  2. Emit particles once
  3. Wait until the lifespan of at least one particle has passed
  4. Emit particles again.

Expected behavior

You should be able to emit particles again after they expire. Allowing for the same particle emitter to be used for long periods of time. I assume this issue arises from some logical array index error, keeping track of the particles.

Screenshots

image image

lajbel commented 1 month ago

Can you provide an example on KAPLAYGROUND?

tristanperrow commented 1 month ago

Was fixed as of 4000.0-alpha.8 due to MF's fix for particles commit.