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

    • CommentAuthoraobyrne
    • CommentTimeJul 14th 2009
     
    My particles have a random feature/aspect/characteristic so I would like the ParticleCreator2D not to reuse them.
    What I did was to create a new particle factory class, namely ParticleWasteCreator2D, which extends from ParticleCreator2D and override the disposeParticle method as follows:

    override public function disposeParticle(particle:Particle):void
    {
    if (particle is Particle2D)
    {
    particle.isDead = true;
    }
    }

    Does someone see a better way to do this?
    Am I missing something?

    Thanks for your help.
    And thanks for this brilliant framework.
    • CommentAuthorRichard
    • CommentTimeJul 21st 2009 edited
     
    You're looking for something like this...

    package org.flintparticles.twoD.particles
    {
    import org.flintparticles.common.particles.Particle;
    import org.flintparticles.common.particles.ParticleFactory;

    public class SimpleParticleCreator2D implements ParticleFactory
    {
    public function SimpleParticleCreator2D()
    {
    }

    public function createParticle():Particle
    {
    return new Particle2D();
    }

    public function disposeParticle( particle:Particle ):void
    {
    }

    public function clearAllParticles():void
    {
    }
    }
    }
    • CommentAuthoraobyrne
    • CommentTimeJul 28th 2009
     
    Thank you.