Flint Particle System Forum - Explode Image + Logo Tween2011-10-17T02:07:02+01:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
Explode Image + Logo Tweenhttp://flintparticles.org/forum/comments.php?DiscussionID=497&Focus=1663#Comment_16632011-07-09T20:57:22+01:002011-07-31T18:12:54+01:00jungalerohttp://flintparticles.org/forum/account.php?u=516
Forgive me if this has been covered, but I haven't found the exact approach I'm looking for.
Put simply, I want to combine the explode image and logo tween examples so I have an image that tweens ...
Put simply, I want to combine the explode image and logo tween examples so I have an image that tweens to a BitmapDataZone on click.
However, the emitter populated with createRectangleParticlesFromBitmapData doesn't seem to respond to TweenToZone. I'm sure I'm missing something, but what?
var explosion:Explosion; var bitmap:BitmapData = new Image1( 384, 255 ); var particlesImage:BitmapData = new ParticlesImage( 320, 80 );
var emitter:Emitter2D = new Emitter2D(); emitter.addAction( new Move() ); emitter.addAction( new DeathZone( new RectangleZone( -10, -10, 510, 360 ), true ) ); prepare();
var renderer:DisplayObjectRenderer = new DisplayObjectRenderer(); addChild( renderer ); renderer.addEmitter( emitter ); emitter.start();
function explode( ev:MouseEvent ):void { var p:Point = renderer.globalToLocal( new Point( ev.stageX, ev.stageY ) );
if (!explosion) { explosion = new Explosion( 2,p.x, p.y, 500 ); //emitter.addAction( explosion ); //emitter.addAction(new MouseGravity(50, stage, 50)); emitter.addAction( new TweenToZone( new BitmapDataZone( particlesImage, 40, 60 ) ) ); } else { //emitter.addAction( new GravityWell( 50, p.x, p.y ) ); } }]]>
Explode Image + Logo Tweenhttp://flintparticles.org/forum/comments.php?DiscussionID=497&Focus=1682#Comment_16822011-07-31T18:11:29+01:002011-10-17T02:07:02+01:00Richardhttp://flintparticles.org/forum/account.php?u=1
This doesn't work as you've coded it because TweenToZone requires the particle to have a lifetime and an age action. The easiest way to achieve what you want is like this
import ...
import org.flintparticles.common.actions.Age; import org.flintparticles.common.initializers.Lifetime; import org.flintparticles.common.particles.Particle; import org.flintparticles.twoD.actions.TweenToZone; import org.flintparticles.twoD.emitters.Emitter2D; import org.flintparticles.twoD.particles.Particle2DUtils; import org.flintparticles.twoD.renderers.DisplayObjectRenderer; import org.flintparticles.twoD.zones.BitmapDataZone;
var bitmap : BitmapData = new Image1( 384, 255 ); var particlesImage : BitmapData = new ParticlesImage( 320, 80 ); var emitter : Emitter2D = new Emitter2D(); emitter.addInitializer( new Lifetime( 6 ) ); emitter.addAction( new Age() ); emitter.addAction( new TweenToZone( new BitmapDataZone( particlesImage, 40, 60 ) ) );