Monday, October 26, 2009

stack

for (i = 0; i < 50; i++) {
circleDef.radius = Math.random()/20+0.02;

bodyDef = new b2BodyDef();
bodyDef.position.Set(Math.random()*8+140,1);
bodyDef.allowSleep = true;
bodyDef.linearDamping = 0.1;
bodyDef.angularDamping = 0.1;

b = world.CreateBody(bodyDef);

b.CreateShape(circleDef);
b.SetMassFromShapes();


var circle:Circle=new Circle()
circle.x= b.GetPosition().x* 50
circle.y= b.GetPosition().y* 50
circle.rotation = b.GetAngle() * (180/Math.PI);

screen.addChild(circle)
b.m_userData = circle;
}

FEEDJIT Live