Basic Filler engine with Box2D – part 2

Some time ago I published Basic Filler engine with Box2D – part 1, now it’s time to see the next step.

I am going to add enemies, the evil bouncing balls.

Obviously, enemies aren’t affected by gravity, and this can be made following the instructions published at Managing multiple gravities with Box2D.

The next, big, problem is enemies must have a constant speed, or at least a minumum speed, otherwise it will be easy to use your generated balls to collide with enemies and change their momentum slowing them down.

This is the part I fully commented on the script, at the moment I don’t manage player deaths, so you can create your red balls wherever you want.

And this is the result:

Click and drag mouse to create and move new balls, the longer you hold mouse button, the bigger the ball

Download the source code with full Box2D modified library