Hello! I’m facing some issues regarding the ParticleEmitter.
I’m currently able to create a particule emitter with a specific texture. However, I would like to change the texture frame of the particles based on a spritesheet animation.
I can use my spritesheet as the current texture for the particles but the particle texture is not animated according to my spritesheet animation. How can I achieve that? I can’t find any example for this specific issue.
Thanks!
Here’s a pseudo code:
var config = {
speed: { min: this.minSpeed * assetsDPR, max: this.maxSpeed * assetsDPR },
lifespan: { min: this.minLifeSpan, max: this.maxLifeSpan },
scale: { start: this.minScale * assetsDPR, end: this.maxScale * assetsDPR },
blendMode: this.blendMode,
duration: this.duration,
quantity: this.quantity
}
var tempTexture = this.scene.textures.get(this.texture)
var isSpriteSheet = tempTexture && tempTexture.hasOwnProperty('frameTotal')
if (isSpriteSheet) {
// TODO : animate the particles according to the spriteSheet texture
// Test
// config['frames] = ...
}
// Create ParticleEmitter
this.itemObject = this.scene.add.particles(this.x, this.y, this.texture, config)