So my goal is to make a new vent only if there is no “free” vent available. I can’t find anything from reference.html for this… So do I need to use vent’s onEmitEnd function somehow?
One efficient and easy way to do this is just to pre-create however many vents you think you’ll need, then cycle between them when starting a new effect.
local numVents = 5 local vents = {} local current = 0 for i = 1, numVents do vents[i] = CBE.newVent({...}) end local makeEffect = function() current = current + 1 if current \> numVents then current = 1 end vents[current]:clean() vents[current].emitX, vents[current].emitY = [where you want the effect to be] end
This is likely the simplest way to do this.
- Caleb
One efficient and easy way to do this is just to pre-create however many vents you think you’ll need, then cycle between them when starting a new effect.
local numVents = 5 local vents = {} local current = 0 for i = 1, numVents do vents[i] = CBE.newVent({...}) end local makeEffect = function() current = current + 1 if current \> numVents then current = 1 end vents[current]:clean() vents[current].emitX, vents[current].emitY = [where you want the effect to be] end
This is likely the simplest way to do this.
- Caleb