Flint Particle System Forum - createRectangleParticlesFromBitmapData, working out how to animate these particles:2010-12-26T17:45:55+00:00http://flintparticles.org/forum/
Lussumo Vanilla & Feed Publisher
createRectangleParticlesFromBitmapData, working out how to animate these particles:http://flintparticles.org/forum/comments.php?DiscussionID=261&Focus=931#Comment_9312009-10-14T15:49:35+01:002010-12-26T17:45:55+00:00rez1nhttp://flintparticles.org/forum/account.php?u=255
I'm trying to figure out how I can animate the particles I have created using createRectangleParticlesFromBitmapData
here is my ...
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_9382009-10-19T22:11:19+01:002009-10-19T22:12:30+01:00Richardhttp://flintparticles.org/forum/account.php?u=1
The particles array doesn't contain images, it contains complete particles. To use these particles you add them directly to the emitter, like this
emitter.addExistingParticles( particles, true ...
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.