“Tipsy Tower” HTML5 prototype made with Phaser and Box2D – Step 3: timer, GUI and game over

Here we are with another step of the Tipsy Tower series made with Phaser.

In first step we created the ground, the moving crate, the falling crates and the physics environment.

In second step, we made a fake camera zoom since Phaser does not natively support it.

In this step we are going to add a timer – 30 seconds but you can change it at line 4 – a GUI which displays the time left and it’s not affected by camera zoom, and a game over routine which will make dropped crates disappear once the time is over.

Have a look at the game:

Click to drop the crate. Timer will start once you drop the first crate.

If you have a mobile phone, play the prototype directly at this link.

Now the game is almost completed, what would you like to happen once time runs out?

Editing the script from line 131 will make things happen once the last crate has been destroyed.

Have a look at the code:

Less than 150 lines of code, brackets included, and we almost have a complete game, thanks to Phaser and its awesome Box2D premium plugin.

Next time I will show you the complete game, if you suggest me what to do once the time runs out, meanwhile download the source code.