
Today, I did another quick tech demo and this time I picked the latest as-hive version 3 which uses the new swc to allow me to work completely in FlexBuilder 3. I should also look at in the Flex Profiler and possibly add some other opensource AS3 memory diagnostic views to make sure version 3 is tight.
This is the second time that I've been inspired by one of Emanuele's great demos, and this time I rewrote it to work more like lego blocks -- IMHO more digestable bites -- and also gave the variables clear English names like "groundBody" or "meteorBallBody".
as-hive and box2d demo
code sample:
public function PhysicsWorld():void
{
createWorld();
drawDebug();
drawGround();
drawBuilding();
drawMeteor();
addEventListener(Event.ENTER_FRAME, enterFrameHandler);
}
full source
I added some comments throughout the code. For instance, if you change the density of the meteor from 100 to 10 it will land peacefully on the roof like a zeppelin but that's another game.
For time to time, we'll try to post small samples like this. Now, onto to skinning the objects and playing with setPixel32 to rip into them.