Fork me on GitHub
Not signed in (Sign In)
    I really like this system the little I have played with it. I am using Brownian Motion for an effect I wanted to create - has anyone tried to modify the example so that the particles react somehow (perhaps are repelled) by a mouseover?
    Here is how I am using it - I think the particles look really nice in how they behave.
    I am thinking antigravity would work so I added the last line below:

    emitter.addAction( new Move() );
    emitter.addAction( new Collide( 1 ) );
    emitter.addAction( new BoundingBox( 0, 0, 936, 533, 1 ) );
    emitter.addAction( new ShowAirAction( stage ) );

    emitter.addAction( new MouseAntiGravity (100, 1));
    Which causes this error
    1067: Implicit coercion of a value of type int to an unrelated type flash.display:DisplayObject.
    ok actually I got it to work by adding emitter.addAction( new MouseAntiGravity(200,renderer) );
    to the last line of code.

    What I was hoping for was something that would repel objects from the mouse and then would fade back over time. Is it possible to attach antigravity to the mouse itself? (and then would I need to employ a tween to get them to slow down or will this happen automatically?)
    • CommentAuthorRichard
    • CommentTimeJan 25th 2010

    Sorry, there was a bug in the MouseAntiGravity that stopped it working as expected. I've checked the fix into SVN. If you don't want to use the SVN version, then the work around is to reset the power after creating the MouseAntiGravity object, like this

    var antiGravity : MouseAntiGravity = new MouseAntiGravity( 200,renderer );
    antiGravity.power = 200;
    emitter.addAction( antiGravity );

    Thank you Richard, I will give it a try and let you know if there are any problems.