Playing with Flint

Damn I love messing with Flint – it is one seriously cool particle system 🙂 This is a little test I threw together tonight in about half an hour (includes creating the planet image!). Leave it for a few seconds to see the planet trail burn up, and then just click anywhere you want to re-position the gravity well!

[swfobj src=”” width=”640″ height=”480″]

Code wise it’s extremely simple:

import flash.display.Bitmap;
import flash.display.Sprite;
import flash.geom.Point;
import flash.filters.BlurFilter;
import org.flintparticles.actions.*;
import org.flintparticles.activities.EmitterImage;
import org.flintparticles.activities.RotateEmitter;
import org.flintparticles.counters.*;
import org.flintparticles.debug.FrameTimer;
import org.flintparticles.emitters.*;
import org.flintparticles.initializers.*;
import org.flintparticles.zones.*;

public class tinderbox extends Sprite
private var emitter:PixelEmitter;
private var gravwell:GravityWell;
private var planet:Bitmap;

public function tinderbox():void
planet = new Bitmap(new planetPNG(90, 90));
planet.x = 354;
planet.y = 106;

var t:FrameTimer = new FrameTimer();

stage.addEventListener(MouseEvent.CLICK, randomGW, false, 0, true);


private function init():void
emitter = new PixelEmitter();

emitter.addFilter( new BlurFilter( 4, 4, 1 ) );
emitter.setCounter(new Pulse(1, 200));
emitter.addAction(new ColorChange(0xffffff00, 0xffdd0000));
emitter.addInitializer(new Position(new DiscZone(new Point(398, 150), 41)));
emitter.addInitializer(new Lifetime(4, 8));
emitter.addAction(new Age());
emitter.addActivity( new RotateEmitter(10));
emitter.addAction( new RandomDrift(40,40));
emitter.addAction(new Move());
emitter.addAction(new LinearDrag(0.5));
gravwell = new GravityWell(450, 47, 439);

emitter.addAction( gravwell );



private function randomGW(event:MouseEvent):void
var x:int = mouseX;
var y:int = mouseY;

trace(“new gw at ” + x + ” ” + y);

emitter.removeAction( gravwell );
gravwell = new GravityWell(470, x, y);
emitter.addAction( gravwell );



Posted on April 10th 2008 at 10:46 pm by .
View more posts in Experiments. Follow responses via the RSS 2.0 feed.

3 Responses

Leave a comment

Make yourself heard