So confused

Okay, I'm coming from an APE background (literally and figuratively) so can someone please just show me how to make a ball bounce on a rectangle ground with Box2D? Adding a body and then a world and then adding a shape to a world... all very confusing. I tried following the tutorial but have been unable to get anything to actually appear on the screen.

Thanks in advance,
-Danny
The first step is getting the test level to run. Are you able to compile that and get it running?
Yes. But see the TestBed's classes extend Test. And Test references Main. I just want the code to create two circles on the screen with gravity.
Check out the HelloWorld example.

It's a single .as file that adds a static ground body and some falling boxes and circles, using MovieClips from the library.

Let us know if you have any specific troubles.

-Matt
HelloWorld is a great example, but like you said it loads clips from the library. Is there a way to disable userdata property and just use basic vectors?
Box2d itself doesn't include any code for display. So it is necessary to add a certain amount of code, making any such simple example longer than the corresponding APE code. The two testbed examples provide examples of the code required for different ways of displaying objects. Yes, PhysTest.fla is slightly more involved as it requires several classes, but the majority of it's length is unavoidable just to draw vector shapes. This is the price you pay when you write an incredibly portable and flexible engine like box2d, rather than APE aimed entirely at Flash.

Thought it would be possible to produce a more streamlined version, I suggest you try to adapt PhysTest.fla (or HelloWorld.fla), rather than seeking a shorter snippet of code for your example. It is not really as complicated as you might think, once you examine it; most of the files just define the layout of the various different examples.
Thanks Boris,

I finally was able to do it and understand how things work now. Had to add that function that actually draws the vector.

I just wish Box2D was more code friendly. The code looks very bloated just to add a few objects. What does AAAB stand for? Why can't the constructors take in any parameters?
hey k2xl, I came over from the ape physics engine aswell and was totally put off by the vastly different coding style in the box2d engine thanks to having having no knowledge whatsoever of C or C++. But stick with it, yes the coding style is slightly different to usual flash api's but thats because its a port from the C++ version and after time you will appreciate the similarity as all the help and source available for the c++ version can mostly be applied to the flash port easily.
Yes, the code does show it's heritage quite clearly. It goes out of its way to avoid features that are extremely common place in Flash, and emulates structures with objects, and has global functions to replace operator overloads. A less literal port might be nice, but I think it's not worth losing the advantage that it behaves very similarly to the original, making further ports and discussions possible. Frequently I see code posted here and am unable to tell what language it is in.

An AABB by the way is an Axis Aligned Bounding Box. That is to say, a rectangle with vertical sides that contains the shape in question. They are used extensively in Box2d (and other engines) as a way of simplifying shapes, when the exact shape doesn't matter. You might also see OBBs (oriented bounding boxes) occasionally in the box2d internals, which are the same, without the restriction that the sides be vertical.

As for why there are no arguments in constructors (or static methods)... I don't know. It is possibly a design choice again. You could say Box2d is not really intended to work out of the box on it's own, it's an engine to add into a project. The testbed examples are minimal projects to get something shown, but a larger project wouldn't be defining levels in code in the same somewhat verbose style. It would have level loading code instead.

Original thread: https://box2d.org/forum/viewtopic.php?t=451