Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthormp
- CommentTimeOct 30th 2008
hi
i 've a particles animation inside a movieclip. this movieclip 've two addEventListener: MOUSE_DOWN to drag and MOUSE_UP to drop.
every time i 'drag' the movieclip (particles container), i add to stage an addEventListener(MOUSE_MOVE) to set the 'explosion' action, while the mouse is moving.
emitter.addAction( new Explosion(.3, 130, 250, 500, 20, 1));
when i 'drop' it i remove the listener from the stage, and i give the emitter an 'accelerate' action, to make them fall down.
emitter.addAction( new Accelerate( 0,10) );
after a few seconds without dragging it, i see that the particles overlap to each other, staying in a slim 'line', as if they were disappearing.
when i start to drag, it seems that i really lost some particles, and the animation becomes progressively slower.
any hints how i could do this in a better way?
thanks!
some of my code:
//---EMITTER PARTICLES
var emitter:Emitter2D = new Emitter2D();
emitter.counter = new Blast( 1000 );
var air:InitializerGroup = new InitializerGroup();
air.addInitializer( new ImageClass( Dot, 2 ) );
air.addInitializer( new ColorInit( 0xFFFFFFFF, 0xFFFFFFFF ) );
air.addInitializer( new MassInit( .5 ) );
air.addInitializer( new CollisionRadiusInit( 2.5) );
emitter.addInitializer( new Position( new RectangleZone( 0, 220, 251, 230 ) ) );
emitter.addInitializer( new Velocity( new DiscZone( new Point( 0, 0 ), 1, 1 ) ) );
emitter.addInitializer( new ChooseInitializer( [ air ], [ 10 ] ) );
emitter.addAction( new Move() );
emitter.addAction( new Collide( 1 ) );
emitter.addAction( new Friction( .5 ) );
emitter.addAction( new BoundingBox( 2, 0, 256, 243, .5 ) );
emitter.addInitializer( new ScaleImageInit( 0.5, 1.3) );
emitter.addAction( new ShowAirAction( stage ) ); -
- CommentAuthorRichard
- CommentTimeOct 30th 2008 edited
If you add an explosion every time you move the mouse, you'll end up with lots of explosion actions all running. That would account for the slow down. You need to remove the explosions when you're finished with them.var explosion:Explosion = new Explosion(.3, 130, 250, 500, 20, 1);
emitter.addAction( explosion );
and lateremitter.removeAction( explosion ); -
- CommentAuthormp
- CommentTimeOct 31st 2008
thanks for all the replies to my posts.
;)
1 to 3 of 3
