“2 Cars” HTML5 prototype part II: adding targets and steering

Here we are with the second part of “2 Cars” game prototype. In the first part we created the bare bones of the prototype, now we are adding targets to collect and a steering effect to the car when it moves through lanes.

As in the original game, missing a target means “game over”, although in our prototype I simply restart the game. Also, I added more difficult by increasing the amount of stuff – target and obstacles – in the game.

So, let’s have a look at the final result:

Click on a lane to make the car change lane, avoid blocks and collect targets.

Here are the new source code with new lines highlighted:

It’s not that much more than a new class and a couple of tweens, but now the game looks better. Next time we’ll see the main menu, some particle effects and how to keep track of the best scores – although you should know how to do it – and the game will be completed. Meanwhile, download the source code of this example.

  • Astro

    Why this not work on iPad?

  • Pooya

    Hi emanueleferonato, im new to html5 game creation and wanted to use your source codes as base for some of my game, for sure lots of changes should happen but just want to 1) write more professional codes (by seeing how you wrote codes) and 2)dont start from zero

    • Pooya

      source code of tutorials like this, not your actual professional games.

      is it ok ?