newEmitter: invalid EmitterObject

Error received using the Corona Docs example to create a new Emitter.

ERROR: invalid EmitterObject stack traceback at this line:

local emitter = display.newEmitter( emitterParams )

Can’t work out why. Anyone to the rescue? This is our first time using newEmitter so it must be something simple.

 -- Table of emitter parameters local emitterParams = { startColorAlpha = 1, startParticleSizeVariance = 53.47, startColorGreen = 0.3031555, yCoordFlipped = -1, blendFuncSource = 770, rotatePerSecondVariance = 153.95, particleLifespan = 0.7237, tangentialAcceleration = -144.74, finishColorBlue = 0.3699196, finishColorGreen = 0.5443883, blendFuncDestination = 1, startParticleSize = 50.95, startColorRed = 0.8373094, textureFileName = "fire.png", startColorVarianceAlpha = 1, maxParticles = 256, finishParticleSize = 64, duration = -1, finishColorRed = 1, maxRadiusVariance = 72.63, finishParticleSizeVariance = 64, gravityy = -671.05, speedVariance = 90.79, tangentialAccelVariance = -92.11, angleVariance = -142.62, angle = -244.11 } -- Create the emitter local emitter = display.newEmitter( emitterParams ) -- Center the emitter within the content area emitter.x = display.contentCenterX emitter.y = display.contentCenterY

I don’t see a field defining the texture name.

textureFileName = "path to image"

Ah, I missed it. “fire.png”…  My bad.

Tip: Are you hand generating this?  You’d be better off starting w/ a tool generated one, then editing it if you need to.

Tip2: I don’t see the problem.  So I’d comment all lines except: 

  • textureFileName
  • duration

Then, if that works, un-comment one line at a time till you find the problem line(s).  Pretty manual, but again I don’t see the issue.

PS - I assume fire.png is in the root folder?

Yes, it was a directory issue. Thanks Ed.

I don’t see a field defining the texture name.

textureFileName = "path to image"

Ah, I missed it. “fire.png”…  My bad.

Tip: Are you hand generating this?  You’d be better off starting w/ a tool generated one, then editing it if you need to.

Tip2: I don’t see the problem.  So I’d comment all lines except: 

  • textureFileName
  • duration

Then, if that works, un-comment one line at a time till you find the problem line(s).  Pretty manual, but again I don’t see the issue.

PS - I assume fire.png is in the root folder?

Yes, it was a directory issue. Thanks Ed.