ABox2D Actionscript 3.0 Style on Box2D
https://sourceforge.net/projects/abox2d/
0.1 beta work on Box2D 2.0.1
sample code
https://sourceforge.net/projects/abox2d/
0.1 beta work on Box2D 2.0.1
sample code
Code:
//world with gravity
var world:ABox2DWorld = new ABox2DWorld( new ABVector(0, 10) );
addChild(world);
var ball:CircleSprite = new CircleSprite(50);
ball.x = 150;
ball.y = 150;
ball.density = 1;
ball.friction = 0.5;
ball.restitution = 0.5;
ball.name = "thisIsBall";
world.addChild(ball);
ball.addEventListener(ABContactEvent.CONTACT_ADD , onHit );
var ground:RectangleSprite = new RectangleSprite(800, 600);
ground.y = 800;
ground.x = stage.stageWidth / 2;
ground.name = "ground";
world.addChild(ground);
private function onHit(e:ABContactEvent):void
{
trace('ball hit' , e.hitTarget.name);
}
world.showDebug();
world.start();
var world:ABox2DWorld = new ABox2DWorld( new ABVector(0, 10) );
addChild(world);
var ball:CircleSprite = new CircleSprite(50);
ball.x = 150;
ball.y = 150;
ball.density = 1;
ball.friction = 0.5;
ball.restitution = 0.5;
ball.name = "thisIsBall";
world.addChild(ball);
ball.addEventListener(ABContactEvent.CONTACT_ADD , onHit );
var ground:RectangleSprite = new RectangleSprite(800, 600);
ground.y = 800;
ground.x = stage.stageWidth / 2;
ground.name = "ground";
world.addChild(ground);
private function onHit(e:ABContactEvent):void
{
trace('ball hit' , e.hitTarget.name);
}
world.showDebug();
world.start();