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

    • CommentAuthortim
    • CommentTimeOct 15th 2008 edited
     
    Just started playing with Flint (great work Richard).

    Anyone have any ideas of how I could set particles to be a bitmap shape periodically?

    So they start as a shape:
    emitter.addInitializer( new Position( new BitmapDataZone(bitmap.bitmapData)));

    Then I animate them by using an Action.

    On a mouse click I'd like them to resume their initial positions.

    One thing I considered was grabbing their positions from the BitmapDataZone and using TargetVelocity action, but this goes against the Flint architecture.

    Thanks,
    tim
    • CommentAuthorRichard
    • CommentTimeOct 15th 2008 edited
     
    Do you want them to return to the exact same position, or to any position inside the bitmap?

    For the same position, you'll need to create a custom initializer based on the Position initializer, that stores the start position in the particle - add

    particle.dictionary["startPosition"] = new Point( particle.x, particle.y );

    at the end of the initialize method, or something similar.

    For a different position in the bitmap, use

    var position:Point = zone.getLocation();

    where zone is your BitmapDataZone.

    To approach the point, you probably want a custom action, which may be similar to TurnTowardsPoint or may be some sort of timed tween. In either case, it will use the point obtained above as the target point for the action.

    Add the action to your emitter to make all the points approach their target, and remove it to make it stop. Or have stop/start methods on the action to turn it on and off.
    • CommentAuthorezra
    • CommentTimeJul 10th 2009 edited
     
    I have reposted my question in a new threat as it was slightly unrealated.