Sprite Sheet For particles Problem

Hello Guys!

I’m trying to use a spritesheet to create an emitter. but for some reason only the first frame is spawned.

here is how i’m doing it.

this.load.spritesheet('veg', './src/assets/image/btnParticles/fruit.png', { frameWidth: 64, frameHeight: 64 });

then

var particles = this.add.particles('veg');

var cherries = particles.createEmitter({
      frames: 0,
      x: 400,
      y: 300,
      speed: 100,
      frequency: 150,
      lifespan: 2000
  });

      var orange = particles.createEmitter({
          frames: 1,
          x: 400,
          y: 300,
          speed: 100,
          frequency: 150,
          lifespan: 2000
      });
1 Like

Hello @and_ctba,
It’s giving you only one frame cause you specify only one frame which is the first one

you might wanna try
frame: { frames: [ 'red', 'blue', 'green', 'yellow' ], cycle: true }

or check this example or this one

1 Like

Hey hcakar,

Thanks for your answer, i was using the same example before. The problem actually was in the typescript definitions. You will share that if someone else find same problem.

This is what I changed to have it working.
frame? : number | number[] | string | string[] | Phaser.Textures.Frame | Phaser.Textures.Frame[] | ParticleEmitterFrameConfig;
// frames?: number | number[] | string | string[] | Phaser.Textures.Frame | Phaser.Textures.Frame[] | ParticleEmitterFrameConfig;

Thanks!