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

    • CommentAuthorNateDog
    • CommentTimeJul 16th 2008
     
    Richard, thanks for this incredible particle system. I've just been playing with it a day but I really like it. I am hoping to build a weapon class on top of Flint. Many of the current weapons we want to design are not typical bullet type weapons. They are lasers and lightning bolts that will actually render for 1-2 seconds. I think I need to define an Activity (or would it be an Action?) where I pass in a MovieClip instance and then the destination of the particles will follow the MovieClip when a weapon is fired.

    In other words, during the weapon firing, the target will be moving and so the emitter needs to constantly change its target. I think I should be using Blast in conjunction with a custom Class definition to have the blast particles constantly move toward the target MovieClip (which will be moving).

    If anyone could point me in the right direction in terms of is this an Action or an Activity? Or is this already supported by using the correct attributes on a GravityWell?

    I made my own Action called TurnTowardMovieClip based on TurnTowardMouse but it seems to zjigzag its way to the target like a snake. Kinda cool, but not too laser-like :o

    Thanks in advance for anyone with ideas on best approach. And thanks again richard for Flint ... it's AMAZING!
    • CommentAuthorRichard
    • CommentTimeJul 16th 2008
     
    Hi

    The difference between activities and actions is what they affect. An activity alters the state of the emitter, and an action alters the state of the particles that were created by the emitter.

    If you use a Blast counter, as you suggest, to throw a bunch of particles at a target and alter the particles in flight then the particles will physically change direction while moving. Is that what you want? If so the TurnTowardsMovieClip action is what you need (more on the zig-zag at the end of the post).

    Or do you want the particles to move in a straight line once they have been emitted? But all new particles to be directed towards the target's current position. In that case, you would want to alter the direction of motion of new particles as they are created. This could be done one of two ways.


    1. Use a custom activity to continuously rotate the emitter to face towards the target.

    2. Use a custom initializer to initialize each particle's initial velocity to direct it towards the target.



    Either option would be fine - the difference will only be noticeable if you are also using the EmitterImage activity. If you are, option 1 will rotate the emitter image while option 2 will not.

    Re: The problem with the TurnTowards actions.

    The problem with the TurnTowards actions is that they don't know when they sometimes turn too far, then turn back again, and back again, and thus zig-zag. This is particularly common if you apply a large power to the turning movement. The action was designed for doing simple swarming behaviour, which involves gradual turns with a low power setting.

    I have just now fixed the problem with the zigzag and checked new versions of TurnTowardsMouse and TurnTowardsPoint into SVN five minutes age.