“CLOCKS – The Game” HTML5 prototype step 3: actually playing the game

Welcome to the 3d step of “CLOCKS – The Game” HTML5 prototype. It’s time to play the game, but first let’s make a recap of the previous two steps:

In first step I showed you how to generate the first 10 levels, both with objects and with arrays generated by Tiled Map Eeditor.

In second step I showed you how to select a random starting clock.

Now it’s time to play the game, advancing levels if you solve them, or restarting if you fail.

Click to fire a ball from the highlighted clock, trying to hit another clock and highlight it, until all clocks have been highlighted.

We start with a random highlighted clock. With a click/tap input anywhere on the canvas we fire a ball according to hand angle.

Then we have a collision check looking for the ball and a clock overlap. If they overlap, we can say the ball hit the clock so we destroy the ball and set the clock as highlighted.

The source code is still uncommented because I want to add at least 20 more levels of the original game and the same star scoring system.

While there’s still some work to do before we have a fully working game, the main engine is ready and you can start playing the game already. Download the source code as I advance through levels in the original game to show you how to create them.