Delay Particle Start

8 views
Skip to first unread message

Taylor

unread,
Mar 4, 2010, 1:55:42 AM3/4/10
to Stardust Particle Engine
Is there a simple way to delay when the particle emitter begins? For
example, if I want the fireworks to begin at frame 200.

I've tried a few ideas but am not really getting anywhere.

Cheers,
Taylor.

CJ Cat (Allen Chou)

unread,
Mar 4, 2010, 11:13:15 AM3/4/10
to Stardust Particle Engine
One easy to do that is to make use of the Emitter.active property. If
the property is set to false, the emitter stops creating particles,
regardless of the assigned clock; however, note that existing
particles are still being updated in each emitter step. You can assign
a clock to the emitter, and set the emitter's active property to
false. Next, use a timer or anything you like to count for 200 frames,
and then reset the emitter's active property back to true. This shall
delay the particle emission for 200 frames.

Taylor

unread,
Mar 4, 2010, 6:54:21 PM3/4/10
to Stardust Particle Engine
Great, thanks mate. Worked a treat.

After setting emitter.active to false - here is the timer I used to
kick things off (for anyone interested):

//delay
var myTimer:Timer = new Timer(1000,5);
myTimer.addEventListener(TimerEvent.TIMER, timerListener);
function timerListener (e:TimerEvent):void{
trace("Timer is Triggered");
}
myTimer.start();

myTimer.addEventListener(TimerEvent.TIMER_COMPLETE, timerDone);
function timerDone(e:TimerEvent):void{
trace("Timer finishing!");
myTimer.stop();
emitter.active = true;
}

Thanks again.

Reply all
Reply to author
Forward
0 new messages