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

    • CommentAuthormnu7
    • CommentTimeFeb 20th 2011
     
    how can I generate particles at certain gap.
    As In snowfall example particles are created randomly
    emitter.addInitializer( new Position( new LineZone( new Point( -5, -5 ), new Point( 505, -5 ) ) ) );

    But how to control these particles so that they generate at specific distance from each other in a a proper fashion.
    Please suggest
    • CommentAuthorRichard
    • CommentTimeFeb 27th 2011
     
    Setting the start position for each particle is something any initializer can do. Flint doesn't include a specific grid position initializer, but it's very simple to do. A custom initializer to set the position would look something like this...

    package
    {
    import org.flintparticles.common.emitters.Emitter;
    import org.flintparticles.common.initializers.InitializerBase;
    import org.flintparticles.common.particles.Particle;
    import org.flintparticles.twoD.particles.Particle2D;

    public class CustomPosition extends InitializerBase
    {
    override public function initialize( emitter : Emitter, particle : Particle ) : void
    {
    var p:Particle2D = Particle2D( particle );
    p.x = ...; // set the particle's x position
    p.y = ...; // set the particle's y position
    }
    }
    }