Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

    •  
      CommentAuthorifthenelse
    • CommentTimeNov 18th 2008
     
    Hello, first of all thank you for this useful libs! It's an awesome job and easy to learn also for a newbie like me.
    Unfortunately I've got a problem while making an intro for a website: it consists in some particels which start out of the stage which should converge into a cirlce area at the center of the stage.
    I used a GravityWell at the center of the stage to impress the acceleration to particles, but when they reach a circle position, they start to overlap each other. Instead of this I want they to pogressively decellerate and then stop within a circular area around the center fo the stage. I don't know if I should consider another choice. Please, can anybody help me?

    Heres the code:

    import flash.geom.Point;
    import org.flintparticles.common.counters.*;
    import org.flintparticles.common.displayObjects.Dot;
    import org.flintparticles.common.initializers.*;
    import org.flintparticles.twoD.actions.*;
    import org.flintparticles.twoD.emitters.Emitter2D;
    import org.flintparticles.twoD.initializers.*;
    import org.flintparticles.twoD.renderers.*;
    import org.flintparticles.twoD.zones.*;

    var emitter:Emitter2D = new Emitter2D();
    var HCenter:Number = stage.stageWidth/2;
    var VCenter:Number = stage.stageHeight/2;
    var startRadiusMax:Number = stage.stageWidth+30;
    var startRadiusMin:Number = stage.stageWidth+10;

    emitter.counter = new Blast( 400 );
    emitter.addInitializer( new ImageClass( Dot, 8 ) );
    emitter.addInitializer( new ColorInit( 0xFFFFFFFF, 0xFFFFFFFF ) );
    emitter.addInitializer( new CollisionRadiusInit( 7 ) );
    emitter.addInitializer( new Position( new DiscZone( new Point( HCenter, VCenter ), startRadiusMax, startRadiusMin ) ) );

    emitter.addAction( new Move() );
    emitter.addAction( new Collide( 0.1 ) );
    emitter.addAction( new GravityWell( 500, HCenter, VCenter, 1000 ) );

    var renderer:DisplayObjectRenderer = new DisplayObjectRenderer();
    addChild( renderer );
    renderer.addEmitter( emitter );

    emitter.start();
    emitter.runAhead(10);
    • CommentAuthorRichard
    • CommentTimeNov 18th 2008
     
    You could try making the gravity well into a ZonedAction, so that it only affects particles that are outside the circle. Also apply some drag so the particles slow down and stop when inside the circle. If you want to make sure the particles don't overlap, you could add a collide action so that they bounce off each other.
    •  
      CommentAuthorifthenelse
    • CommentTimeNov 18th 2008 edited
     
    Thanks Richard for the ZonedAction and drag actions. You saved my job, now it works!
    • CommentAuthormo
    • CommentTimeJan 23rd 2009
     
    hi ifthenelse,
    can you please post your code with the ZonedAction? would be helpful for me to see how you used that, because im new with as3 and flint...
    thank you so much