Particle Emitter

Hi,

I’ve just switched to the built-in particle and purchased Particle Designer.

I have imported my explosion particle but I noticed I am unable to show multiple explosions on the screen at the same time or within a small timescale.

Every time I call start() it resets the other particles that are emitting.

Unlike CBEffects where I could have an emitter within small time scale and it would continue till it finishes.

Thanks, for any information.

Hi @jm.8,

Can you post some of your code (minimized to the relevant code) which shows how you’re setting up the emitter(s) and starting them?

Thanks,

Brent

local function loadParticle( path ) local filePath = system.pathForFile( path ) local f = io.open( filePath, "r" ) local fileData = f:read( "\*a" ) f:close() local emitterParams = json.decode( fileData ) emitterParams.textureFileName = "particle\_textures/" .. emitterParams.textureFileName return display.newEmitter( emitterParams ) end explosionEmitter = loadParticle( "particles/explosion.json" ) // when an enemy dies explosionEmitter.x = enemy.x explosionEmitter.y = enemy.y explosionEmitter:start()

Hi,

Thanks for replying.

I can paste the explosion.json if you need that also.

Hi @jm.8,

You’re using the same reference to the emitter each time, so it’s expected that it’ll control them all “as one”. You should create individual instances of emitters and, ideally, store them all inside table so you can access/control them if necessary.

Brent

Hi @jm.8,

Can you post some of your code (minimized to the relevant code) which shows how you’re setting up the emitter(s) and starting them?

Thanks,

Brent

local function loadParticle( path ) local filePath = system.pathForFile( path ) local f = io.open( filePath, "r" ) local fileData = f:read( "\*a" ) f:close() local emitterParams = json.decode( fileData ) emitterParams.textureFileName = "particle\_textures/" .. emitterParams.textureFileName return display.newEmitter( emitterParams ) end explosionEmitter = loadParticle( "particles/explosion.json" ) // when an enemy dies explosionEmitter.x = enemy.x explosionEmitter.y = enemy.y explosionEmitter:start()

Hi,

Thanks for replying.

I can paste the explosion.json if you need that also.

Hi @jm.8,

You’re using the same reference to the emitter each time, so it’s expected that it’ll control them all “as one”. You should create individual instances of emitters and, ideally, store them all inside table so you can access/control them if necessary.

Brent