pixijs / particle-emitter

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

AnimatedParticles error with textures in atlas #137

Closed grevius5 closed 2 years ago

grevius5 commented 4 years ago

I use Pixijs V5.2.4 I'm trying to follow the tutorial of the flipping coins here but I'm not able to get it working in my game. I'm using this: this._emitterCoins = new particles.Emitter( container, [ { framerate: 30, loop: true, textures: [ "coin_01", "coin_02", "coin_03", ] }, ], ... When I try to start the emitter I have the following error: Uncaught TypeError: Cannot read property 'valid' of undefined Sprite.js:657

The textures are corrects, and it works if I use this as textures array: this._emitterCoins = new particles.Emitter( container, [ "coin_01", "coin_02", "coin_03", ], ...

What i'm doing wrong?

andrewstart commented 4 years ago

Is that the only error that appears? Your pasted code has trailing commas in the texture array. I don't recall how Javascript handles that, but if it puts an undefined value in the array the AnimatedParticle code would throw an error when setting up the emitter. You also need to ensure you are setting the particleConstructor property on the emitter.

grevius5 commented 4 years ago

O thanks, I was missing the particleConstructor settings! There is some documentation to follow?

andrewstart commented 4 years ago

There's no step by step guide, but the documentation is located here: http://pixijs.github.io/pixi-particles/docs/