Jump to content

Custom Particle Emitter failing to find sprite sheet cache?


Recommended Posts

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();

        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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...