The game
The project game we'll build in this chapter is simply called Basic Jelly Wobbling Gravity Game. The goal of the game is to feed our main hero enough jelly that he gets sick and drops to the floor with a severe tummy ache. The main character is controlled through the left and right arrow keys on the keyboard, and in order to eat a jelly, you simply have to direct the hero underneath a falling jelly. Every time you feed the hero a jelly, his health meter decreases slightly. Once enough jelly has been fed, and the health meter reaches zero, the hero gets too sick and faints. If you let a jelly drop on the floor, nothing happens except that the jelly splashes everywhere. This is a Basic Jelly Wobbling Gravity Game. Can you serve Prince George enough jelly until he passes out?
In order to demonstrate a few principles about HTML5 game development, we'll build this game completely with DOM elements. While this approach is normally not the desired approach, you will notice that many games...