Flint Particle System Forum - Revive a particle where it died2012-05-26T06:19:25+01:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Revive a particle where it diedhttp://flintparticles.org/forum/comments.php?DiscussionID=549&Focus=1877#Comment_18772012-01-15T05:50:53+00:002012-05-26T06:19:25+01:00fredhttp://flintparticles.org/forum/account.php?u=510
Hello, I am trying to revive the same particle at the same position where it died using TwoWay.sine for the age... so far, the particle gets a new random x and y. Thanks for your ...
fred
var myApple:Apple = new Apple(); var myMickey:Mickey = new Mickey(); var myMarlboro:Marlboro = new Marlboro(); var myNike:Nike = new Nike();
var myArray:Array = [myApple, myMickey, myMarlboro, myNike ];
renderer = new DisplayObjectRenderer(); addChild(renderer); emitter = new Emitter2D(); renderer.addEmitter(emitter);
emitter.addInitializer( new Position( new RectangleZone( 0, 0, 1024, 768))); emitter.addInitializer( new Lifetime(10, 20)); emitter.addAction( new Move()); emitter.addAction( new Age(TwoWay.sine)); emitter.addAction( new Fade());
var myParticles:Vector.<Particle> = Particle2DUtils.createParticles2DFromDisplayObjects( myArray ); emitter.addEventListener( ParticleEvent.PARTICLE_DEAD, revive4Particles );
private function revive4Particles( event:ParticleEvent ):void { event.particle.revive(); event.currentTarget.addParticle(Particle2D(event.particle), true); }]]>
Revive a particle where it diedhttp://flintparticles.org/forum/comments.php?DiscussionID=549&Focus=1878#Comment_18782012-01-21T11:13:16+00:002012-05-26T06:19:25+01:00Richardhttp://flintparticles.org/forum/account.php?u=1
The second parameter in the addParticle method indicates whether the emitter's initializers should be applied to the particle being added. By setting it to true you are applying the emitter's ...
Revive a particle where it diedhttp://flintparticles.org/forum/comments.php?DiscussionID=549&Focus=1879#Comment_18792012-01-22T01:55:39+00:002012-05-26T06:19:25+01:00fredhttp://flintparticles.org/forum/account.php?u=510
Hey Richard,
Thanks for your response. I understand that if set to true, I am applying the emitter's initializers to the particle.
I could set it to false but I need other addInitializers like ...
Thanks for your response. I understand that if set to true, I am applying the emitter's initializers to the particle. I could set it to false but I need other addInitializers like Lifetime and also actions like Move, Age and Fade. Any way to select what to apply? Should I recreate a new emitter, pass the particule and kill the old one? Thx again. Fred]]>
Revive a particle where it diedhttp://flintparticles.org/forum/comments.php?DiscussionID=549&Focus=1880#Comment_18802012-01-22T02:15:05+00:002012-05-26T06:19:25+01:00fredhttp://flintparticles.org/forum/account.php?u=510
SOLVED :)
Removing the position Initializer did the trick.
thx
var myApple:Apple = new Apple();
var myMickey:Mickey = new Mickey();
var myMarlboro:Marlboro = new Marlboro();
var myNike:Nike = ...
Removing the position Initializer did the trick. thx
var myApple:Apple = new Apple(); var myMickey:Mickey = new Mickey(); var myMarlboro:Marlboro = new Marlboro(); var myNike:Nike = new Nike();
var myPosition:Position;
var myArray:Array = [myApple, myMickey, myMarlboro, myNike ];
renderer = new DisplayObjectRenderer(); addChild(renderer); emitter = new Emitter2D(); renderer.addEmitter(emitter);
emitter.addInitializer( new Lifetime(10, 20)); emitter.addAction( new Move()); emitter.addAction( new Age(TwoWay.sine)); emitter.addAction( new Fade());
var myParticles:Vector.<Particle> = Particle2DUtils.createParticles2DFromDisplayObjects( myArray ); emitter.addEventListener( ParticleEvent.PARTICLE_DEAD, revive4Particles );