Welcome, Guest
Want to take part in these discussions? Sign in if you have an account, or apply for one below
-
- CommentAuthorjmp909
- CommentTimeMay 12th 2010 edited
Hi
I'm trying to explode a bitmap, with a fade on the particles. With my code below if i uncomment the Age and the Fade my particles don't show at all. What I want to do is have the particles begin to fade out as they reach a certain radius from the explosion centre.
Separately to this instead of using actual chunks of the bitmap I'd like to use, for example, 3x3 square particles that use getPixel on the image to get various colours from the image, and also add a blur/glow to that particle. (like this which currently doesn't use Flint.. http://www.brahm.com/download/test/box2d/test1/)
Any help on both of these would be much appreciated
regards
J
---
public function explode(actor:Actor)
{
renderer = new BitmapRenderer(new Rectangle( 0, 0, 320, 480 ) );
addChild( renderer );
var emitter:Emitter2D = new Emitter2D();
var BMPReference:Class = getDefinitionByName("FruitIcon1") as Class;
var bounds:Rectangle = actor.skin.getBounds(actor.skin.parent);
var bd:BitmapData = new BitmapData(bounds.width*actor.skin.scaleX, bounds.height*actor.skin.scaleY, true, 0x00000000);
var m:Matrix = actor.skin.transform.matrix.clone();
m.tx = -bounds.x*actor.skin.scaleX; m.ty = -bounds.y*actor.skin.scaleY;
bd.draw(actor.skin, m);
var bitmap:Bitmap = new Bitmap(bd, "auto", false);
var particles:Array = Particle2DUtils.createRectangleParticlesFromBitmapData( bitmap.bitmapData,8, emitter.particleFactory, obj.x-(actor.skin.width/2), obj.y-(actor.skin.height/2));
emitter.addExistingParticles( particles, false );
emitter.addAction( new Move() );
emitter.addAction( new Accelerate( 0, -25 ) );
emitter.addAction( new Explosion( 10, obj.x, obj.y, 200,10) );
//emitter.addAction(new Age());
//emitter.addAction(new Fade(1, 0.5));
emitter.start( );
emitter.addEventListener(EmitterEvent.EMITTER_EMPTY, onEmitterEmpty);
renderer.addEmitter(emitter);
} -
- CommentAuthorRichard
- CommentTimeMay 19th 2010
I don't know why removing the fade action causes the particles to not appear. I can't see anything in your code that should cause that. The Fade action forces the alpha of the particles to the appropriate value, so the most likely cause is that some other code sets the alpha to zero, although I can't see anything in your code that would do that.
For the blurred particle, you probably want a variant on the createRectangleParticlesFromBitmapData() method. You could just add a blur filter when creating the particles, or maybe something else.
1 to 2 of 2
