Box2DWith

Announcing my newest finished project, Box2DWith. I’m collecting together various utility classes for doing all the stuff with Box2DFlashAS3, but found annoying. Demo, Docs

Features

At the moment, there are three things you can use Box2D with (hence the name): XML, Graphics and the Flint particle system.

XML

You can now load Box2D definitions from XML files. The XML simple, matches Box2D’s design, and is feature complete with Box2DFlashAS3 2.0.1. A scheme is provided with the help docs.

You can load whole worlds, or just partial definitions, so you can use this utility in sympathy with your own loading techniques.

Graphics

I reworked a reasonable subset of b2DebugDraw to work much better with the Flash API. Neat because it’s pretty common to want to draw things using shapes as the basis, but b2DebugDraw makes this impossible. My version makes it easy to persist a unchanged body inside a Sprite, and also to style things more or less arbitrarily.

Particles

The Flint particle system, it is a pretty cool particle engine. It’s simple to use, but powerful. I like it because it is modular, in fact modular enough that Box2D physics bolts onto it very nicely.

Using the classes provided in Box2DWith/Flint/ you can combine the two in a variety of ways. If you provide just one of BodyRenderer or Collide, then you can update bodies based on particles or visa versa, but if you use both, then properties are shared between them nicely the two systems. You can use all of Flint’s “Activities” while still retaining all of the physics working correctly.

For Flint only users, I’ve simplified the process. Attach the Physics action, and an initializer that gives particles a body, and you are good to go.

Usage

The above gives you an overview of what is available. The ASDoc generated help should instruct you on the specifics. The help is available here, and also in the download. Plus there’s a small example demo.

Attachments

Box2DWith