Flint Particle System Forum - MouseAntiGravity on PixelRenderer? 2011-12-11T10:22:04+00:00 http://flintparticles.org/forum/ Lussumo Vanilla & Feed Publisher MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1598#Comment_1598 2011-04-14T22:56:56+01:00 2011-12-11T10:22:04+00:00 jbitautas http://flintparticles.org/forum/account.php?u=484 Is it possible to use MouseAntiGravity on a PixelRenderer? I'm working on a project similar to the logo example on the homepage, but I want the pixels to get "pushed" away from the mouse ...

var glassImage:BitmapData = new GlassImage ( 100, 250 );
var tween2Emitter:Emitter2D = new Emitter2D();
var renderer:PixelRenderer = new PixelRenderer( new Rectangle( 0, 0, 400, 200 ) );
addChild( renderer );
setChildIndex (renderer, 0);

tween2Emitter.addInitializer( new Lifetime( 6 ) );
tween2Emitter.addAction( new Age( Quadratic.easeInOut ) );
tween2Emitter.addAction( new TweenToZone( new BitmapDataZone( glassImage, 40, 60 ) ) );
tween2Emitter.addAction( new RandomDrift( 20, 20 ) );
tween2Emitter.addAction( new MouseAntiGravity(10,renderer) );

renderer.addFilter( new BlurFilter( 2, 2, 1 ) );
renderer.addFilter( new ColorMatrixFilter( [ 1,0,0,0,0,0,1,0,0,0,0,0,1,0,0,0,0,0,0.97,0 ] ) );
renderer.addEmitter( tween2Emitter );

startEmitter.start();
tween2Emitter.start();


Thanks]]>
MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1599#Comment_1599 2011-04-15T16:26:58+01:00 2011-12-11T10:22:04+00:00 jbitautas http://flintparticles.org/forum/account.php?u=484 So I've taken a different approach from the code above and did get the pixel rendererer working as expected with the MouseAntiGravity function with a Pulse emitter. Now I'm trying to figure out if ...
hit.addEventListener (MouseEvent.ROLL_OVER, antiGrav);

private function antiGrav (event:MouseEvent):void {

startEmitter.removeAction (new TweenToZone (new BitmapDataZone (glass)));
tween1Emitter.removeAction (new TweenToZone (new BitmapDataZone (copy1)));
tween2Emitter.removeAction (new TweenToZone (new BitmapDataZone (glass)));
antiGravity = new MouseAntiGravity (10, renderer);
startEmitter.addAction (antiGravity);
trace ("HIT");
}

Thanks]]>
MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1600#Comment_1600 2011-04-15T19:57:56+01:00 2011-12-11T10:22:04+00:00 jbitautas http://flintparticles.org/forum/account.php?u=484 I've managed to get MouseEvent to work with MouseAntiGravity on mouse click for particles in the TweenToZone without having to use a hit area clip as I mentioned above. I did however have to surround ... MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1601#Comment_1601 2011-04-15T20:03:55+01:00 2011-12-11T10:22:04+00:00 jbitautas http://flintparticles.org/forum/account.php?u=484 Also, for a little bit more clarification on what I'm trying to do, I'm looking for each particle to be affected by the mouse over rather than the whole renderer. Meaning the particle itself has a ... MouseAntiGravity on PixelRenderer? http://flintparticles.org/forum/comments.php?DiscussionID=471&Focus=1608#Comment_1608 2011-04-20T08:18:32+01:00 2011-12-11T10:22:04+00:00 Richard http://flintparticles.org/forum/account.php?u=1 Hi You can't combine physics based actions like MouseAntiGravity, with literal actions like TweenToZone because the literal action ignores the physics and sets the particle position where it ...
You can't combine physics based actions like MouseAntiGravity, with literal actions like TweenToZone because the literal action ignores the physics and sets the particle position where it thinks it should be regardless. You could try some other method to move the particles towards their destination or create a custom renderer along the lines of the TweenToZone but using physics (maybe use the destination in the zone as a gravity well for that particle rather than a literal tween destination).

For the mouse events, the renderer has its mouseEnabled and mouseChildren set to false by default. If you set the mouseEnabled to true you won't need to wrap the renderer in a movie clip.

You can only get mouse events on specific particles if you use the DisplayObjectRenderer (and set mouseChildren to true), because this is the only renderer in which the particles are rendered as discrete display objects - the BitmapRenderer and PixelRenderer render all the particles in a single Bitmap object.

Hope that helps. Sorry you had to wait a while for a reply.]]>