Creation of a Flash Stabilize! clone using Box2D – part 1

In Triqui’s picks 1 I told you Stabilize! is a good game to clone using Box2D.

And I would use this post to focus on another thing too… it’s about recycling.

I mean… once you code for a while, or follow developer’s blogs like this one providing a lot of source codes, probably most of the stuff you need has already been written here and there.

In this case, the script we are going to modify is Drawing boxes on the fly in Box2D.

You will see we can make the whole game simply changing the original script step by step.

Coding this way will speed up your learning curve because you are starting from a working project so you don’t have to worry about the overall environment, and you can focus on small changes.

In this first step, we’ll just spend a couple of words about the balance bar.

It’s made up with a static object (the fulcrum) and a dynamic one (the bar).

In order to work, the density of the bar should be quite greater than the one of the falling boxes, or you’ll risk to lose the bar once the first box falls on it.

And this is the result:

Draw boxes with your mouse and see how does the bar react.

No need to download anything, simply cut/paste the script you can find at Drawing boxes on the fly in Box2D.

Next time, we’ll manage “true” crates.