Hi All,
I’ve been having some issues with display.newEmitter( ) and need some help!
My goal is to use display.newEmitter( ) to emulate confetti when beating a game level.
Everything is up and working except one small aspect – the underlying image is transparent and I can’t make it opaque! (I do NOT want it to be transparent)
Please see the attached image (“screenshot.jpg”) below to get a better understanding of what I am experiencing.
Here is the code:
main.lua
local json = require("json") local cx, cy = display.contentCenterX, display.contentCenterY local myImage = display.newImage("landscape.jpg", cx, cy) myImage.width = 320 myImage.height = 480 local function loadParams(filename) local path = system.pathForFile(filename) local file = io.open(path, "r") local data = file:read("\*a") file:close() return json.decode(data) end local emitter = display.newEmitter(loadParams("confetti.json"))
confetti.json
{ "textureFileName":"confetti.png", "angle":90, "duration":-1, "sourcePositionVariancex":640, "sourcePositionVariancey":480, "speed":100, "gravityy":98, "rotationStart":0, "rotationStartVariance":0, "rotationEnd":720, "rotationEndVariance":49, "startColorRed":1, "startColorVarianceRed":1, "finishColorRed":1, "startColorGreen":1, "startColorVarianceGreen":1, "finishColorGreen":1, "startColorBlue":1, "startColorVarianceBlue":1, "finishColorBlue":1, "startColorAlpha":1, "finishColorAlpha":1, "blendFuncSource":1, "particleLifespan":10, "blendFuncDestination":1, "startParticleSize":30, "finishParticleSize":30, "maxParticles":300, }
As you can see from above, I’ve set both startColorAlpha and finishColorAlpha to 1, so I don’t know why the confetti is still transparent.
Any help/suggestions appreciated.
Thanks in advance!
KC