How can I rig up an if statement that will add particles to the stage based on the ENTER_FRAME update interval?
stage.frameRate = 60;
var currentParticles:uint = 0;
var maxParticles:uint = 1000;
var particlesPerSecond:uint = 100;
addEventListener(Event.ENTER_FRAME, addParticle);
function addParticles(e:Event):void {
if (currentParticles<maxParticles && ?) { // <-- what to put here?
trace(currentParticles);
currentParticles++
}
};
I run into the problem, where if I choose a bigger value for particlesPerSecond than the stage framerate, I don’t add the correct number of particles.
Please help.