Now that all I have left to do is to juice up and sparkle up my current project before submitting to app store, I finally picked up Particle Candy (which I bought something like a year ago.) I can’t believe I haven’t used it sooner. It is great. I started off fooling around with the sample code, then read the tutorial & quickstart on x-pressive website. I now understand the basics to get my particle effects to appear when & where I want them to show up. I’m excited.
Now I’d like to make sure I go about implementing this in a smart way. I use Storyboard API to manage different scenes, so I looked at Storyboard sample code that comes with the Particle Candy – but I’m not sure if I want to create particle types (that defines the properties of each different particle effects) as globals in main lua. I’m wondering what might be the true wisdom in doing so.
For now, I’m doing the following:
Up top where I require other modules and forward declare variables, I have:
local Particles = require("lib\_particle\_candy")
local PCMain
Inside createScene function, I do:
- Create emitters (Edit: with autodestroy set to false, because I don’t want to recreate the emitters that I would use repeatedly)
- Define particle type properties
- Feed emitters (i.e., AttachParticleType)
- Create newImageRect objects with the images I use in particle type and set them to alpha. This basically preloads the particle images as suggested in http://www.x-pressive.com/ParticleCandy_Corona/tutorials.html
Inside enterScene function, I have:
local function PCMain( event )
-- UPDATE PARTICLES
Particles.Update()
end
Runtime:addEventListener( "enterFrame", PCMain )
Inside game logics, wherever I want a specific particle effects to be triggered, I call StartEmitter function.
Inside exitScene function, I have:
Runtime:removeEventListener( "enterFrame", PCMain )
Particles.CleanUp()
Is this a good way to manage the Particle Candy effects with Storyboard API? I’d very much appreciate hearing some insight and wisdom regarding this.
Naomi [import]uid: 67217 topic_id: 33431 reply_id: 333431[/import]