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

    • CommentAuthortlp
    • CommentTimeMar 14th 2008 edited
     
    Hey Richard,
    first of all, i really like flint, thank you for your effort.
    I have a suggestion regarding the creation of particles.
    Wouldn't it be nice if you could set a Custom ParticleCreator to the Emitter? Kind of Factory style.
    I just tried it because i wanted to have particles with a target position.

    let me know what you think about it.

    Again big compliments

    Timo
    • CommentAuthorRichard
    • CommentTimeMar 17th 2008
     
    Hi Timo

    I can think of more than one interpretation of what you're suggesting. Do you have some example code to clarify your idea? Thanks.

    Richard
    • CommentAuthortlp
    • CommentTimeMar 17th 2008
     
    atm flint just can create particles of the type "Particle".
    I wanted to create targeting Particles, so my particles needed a targetPosition property.
    I wrote a TargetParticleCreator which extends ParticleCreator and i overwrote the createParticle method to create instances of TargetParticle.
    But the emitter has no method to set the creator, so i had to modify it:

    private static var _defaultCreator : ParticleCreator = new ParticleCreator();
    private var _creator : ParticleCreator;

    and

    public function set creator(creator : ParticleCreator) : void {
    _creator = creator;
    }

    public function get creator() : ParticleCreator {
    return _creator ? _creator : _defaultCreator;
    }

    Hope you got the point. im kinda busy right now, maybe i can write some more later.

    Thanx

    Timo
    • CommentAuthorRichard
    • CommentTimeMar 18th 2008
     
    Ahh, I see what you mean. Yes, letting you change the particle creator would be a good idea. I'll also create an interface for the factory so you don't have to extend ParticleCreator, just implement the interface.

    There is another option - the dictionary in the particle class is there so you can add additional properties to the particle. I'm not sure which is better in your instance - use the dictionary or extend particle and create a custom particle creator - I just wanted to point out the options so you can choose.
    • CommentAuthortlp
    • CommentTimeMar 26th 2008
     
    Ah ok, didn't get that feature before, but it worked fine with the extended particle. beside that i slightly had to change your code ;)
    Thank you anyway.