Teonnyn Posted June 22, 2018 Share Posted June 22, 2018 I'm trying to create a custom particle emitter that will select random sprites from a sprite sheet while it emits. However, this setup is not working the way I want it to precisely. The emitter fires, and it fails to load the sprite sheet, however the "parent object" also uses the exact same sheet...and loads it just fine. Shown in this example, a working sprite from the sprite sheet. However, the green squares also pull from the same sheet. I saw it working briefly precisely... once, before reloads started producing this effect. I moved the "make particle" out of the generation loop, and it stopped running. The emitter code is bog standard, and just moves a basic emitter from place to place then fires the particles. However, I am using this class as well that generates the effect: export class EmojiParticle extends Phaser.Particle { frameBlock: any; constructor(game: Phaser.Game, x: number, y: number) { super(game, x, y, 'emoji' ); this.frameBlock = this.animations.frameData.getFrameIndexes(); } onEmit() { this.frame = this.frameBlock[Math.floor(Math.random() * this.frameBlock.length)]; } }; This appears to be because the EmojiParticle effect can't read the cache, even though it seems to work. What can I do to fix this? Link to comment Share on other sites More sharing options...
Teonnyn Posted June 22, 2018 Author Share Posted June 22, 2018 Well I feel stupid. Fixed it. Forgot to include this.emitter.particleClass Link to comment Share on other sites More sharing options...
Recommended Posts