Build a HTML5 game like “Ballz” using Phaser and ARCADE physics – adding and destroying blocks

Here we go with the second step of Ballz HTML5 prototype.

In first step we created a bouncing ball with a fake predictive trajectory.

Now it’s time to add the blocks you will destroy by launching the ball at them.

Blocks are ARCADE physics bodies, all children of the same group, since it’s easy to check for collision between groups, and it’s also easy to move all group children with a single tween, when it’s time to scroll down the blocks.

Have a look at the game:

Tap/click and drag to the bottom to aim the ball, release to launch it, if you have a mobile device, you can play it directly from this link.

At the moment blocks do not have a value since there isn’t the “multiball” mode yet, but it will be added in next step. But there’s already a “game over” condition when blocks are too close to the ball.

This is the commented source code:

Will I be able to make the entire game fit in less than 200 lines, comments excluded? The answer in next step, meanwhile download the source code.