Hi,
I have a question regarding JSON files used for emitter objects in the graphics library.
I am trying to emulate colorful confetti effects when beating a level in my game app. Now, please keep in mind the colorful is the operative word here. If we have grey confetti…well, that’s just not very uplifting.
Ideally, each confetti particle will be either red, green, blue or yellow (and NOT black, white, or grey).
This is what my JSON file looks like:
{ "textureFileName":"json/confetti.png", "angle":90, "duration":-1, "sourcePositionVariancex":640, "sourcePositionVariancey":480, "speed":147, "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, "particleLifespan":7, "startParticleSize":30, "finishParticleSize":30, "maxParticles":300, "blendFuncSource":1, "blendFuncDestination":771, }
Since I want the particles to take on colors such as red, green, blue, and yellow, I set startColorVarianceRed/Green/Blue to 1.
The problem with this is that sometimes (i.e. when R,G,B are nearly equal in value) the particles appear greyscale, which is quite depressing for a “victory” scene.
What I want to achieve is for the particles to be Red 25%, Green 25%, Blue 25%, and Yellow 25% of the time, instead of having colors in between.
Is there any way to achieve this?
One way to do this is the create 4 separate json files, but having 4 files just for the 4 colors seems like a gross waste of resources including memory, which is very limited on mobile devices, so this approach is the absolute last resort.
Any solutions/ideas welcome.
Thanks in advance!
KC