Flint Particle System Forum - createRectangleParticlesFromBitmapData, working out how to animate these particles: Sun, 26 Dec 2010 17:46:23 +0000 http://flintparticles.org/forum/ Lussumo Vanilla 1.1.10 & Feed Publisher createRectangleParticlesFromBitmapData, working out how to animate these particles: http://flintparticles.org/forum/comments.php?DiscussionID=261&Focus=931#Comment_931 http://flintparticles.org/forum/comments.php?DiscussionID=261&Focus=931#Comment_931 Wed, 14 Oct 2009 15:49:35 +0100 rez1n
here is my code:
----------------------------------------------------------------
var bitMap = new Bitmap(new Owl(0,0))

var emitter:Emitter2D = new Emitter2D();
var particles:Array = Particle2DUtils.createRectangleParticlesFromBitmapData( new Image1(384,255), 50, emitter.particleFactory, 56, 47 );

var emitter_counter:TimePeriod = new TimePeriod(30,4);
emitter.counter = emitter_counter;

var emitter_action0:Move = new Move();
var emitter_action1:Age = new Age();
var emitter_action2:RandomDrift = new RandomDrift(500,200);
var emitter_action3:Fade = new Fade(1,0);
emitter.addAction(emitter_action0);
emitter.addAction(emitter_action1);
emitter.addAction(emitter_action2);
emitter.addAction(emitter_action3);


var emitter_initializer2:Lifetime = new Lifetime(0.5,1);
var emitter_initializer7:Position = new Position(new DiscSectorZone(new Point(10,10),10,0,360,0));
var emitter_initializer8:Velocity = new Velocity(new DiscSectorZone(new Point(137,123),10,0,360,0));
emitter.addInitializer(emitter_initializer2);
emitter.addInitializer(emitter_initializer7);
emitter.addInitializer(emitter_initializer8);

emitter.addInitializer(new SharedImages([particles])); // if i put 'bitMap' in here it works, however its just 1 bitmap not an array of them like 'particles'

var renderer:BitmapRenderer = new BitmapRenderer(new Rectangle(0, 0, 530, 430));
renderer.addEmitter(emitter);
emitter.start();
addChild(renderer);
----------------------------------------------------------------

I want it to cycle 30 times, or the length of the particles array, through the different particles that i created.

The animation works if i put in the 1 bitmap image but when i try to send it the Array of particles its not working, I know im not seeing somthing here. ]]>
createRectangleParticlesFromBitmapData, working out how to animate these particles: http://flintparticles.org/forum/comments.php?DiscussionID=261&Focus=938#Comment_938 http://flintparticles.org/forum/comments.php?DiscussionID=261&Focus=938#Comment_938 Mon, 19 Oct 2009 22:11:19 +0100 Richard
emitter.addExistingParticles( particles, true );

You'll want to remove the SharedImage imitializer and the Position initializer since the particles are already positioned according to the image layout. Also, remove the counter because you don't want to make any more particles.

See the Explode Image example to see it in action. ]]>