Fork me on GitHub
Not signed in (Sign In)

Welcome, Guest

Want to take part in these discussions? Sign in if you have an account, or apply for one below

  1.  
    I think you're gonna like this..
    I've released a library that ties the Box2D Flash physics engine in with Flint. With a few lines of code, you can have Box2D's full power while still using all the Flint primitives you are used to.

    More details are here, with a demo available.

    If you click twice on the demo, you'll find the "Flint only" example, aimed at Flint users. I append the bulk of the source for that to give you an idea how simple it is to get started.

    BodyRenderer.defaultScale = 10;

    //Create a Flint emitter and initialize it with some standard particles stuff
    emitter = new Emitter2D();
    emitter.counter = new Steady( 15 );
    emitter.addInitializer(new Position(new DiscZone(new Point(0,0),30,30)));
    emitter.addActivity(new FollowMouse(this));
    emitter.addAction(new MutualGravity(3, 100));
    emitter.addInitializer(new Velocity(new DiscZone(new Point(0, 0), 10, 10)));
    emitter.addInitializer(new ImageClass(Dot, 10));
    emitter.addInitializer(new Lifetime(2, 20));
    emitter.addAction(new Fade());
    emitter.addAction(new Age());

    //Use a physics activity, and keep a reference to it.
    var physics:Physics = new Physics();
    emitter.addActivity(physics);
    //Lets give the position solver a bit more pep, as we are creating lots of overlapping shapes
    physics.positionIterations = 30;

    emitter.addInitializer(new CollisionRadiusInit(10));
    emitter.addInitializer(new CircleInit(physics.world));

    renderer = new DisplayObjectRenderer();
    addChild(renderer as DisplayObjectRenderer);
    renderer.addEmitter(emitter);

    emitter.start();


    I'm afraid for more complicated effects, you'll actually need to learn something about Box2D, but nonetheless, I think it's a fairly easy system to use.
    • CommentAuthorRichard
    • CommentTimeFeb 11th 2009
     
    Fabulous.