Book Image

HTML5 Game Development Hotshot

By : Seng Hin Mak, Makzan Makzan (Mak Seng Hin)
Book Image

HTML5 Game Development Hotshot

By: Seng Hin Mak, Makzan Makzan (Mak Seng Hin)

Overview of this book

Table of Contents (15 chapters)
HTML5 Game Development HOTSHOT
About the Author
About the Reviewers

Choosing which building to build

In this task, we let the player choose three types of buildings to create. These buildings are the power supply, coins generator, and merchant building. We create a building panel interface for this purpose.

Prepare for lift off

This is going to be a long task. The following screenshot previews what we are going to archive in this task so that we have a better understanding when reading the code:

The button image follows a common practice in web design. We put the normal, hover, and active states into one image. Let's prepare the image files. Insert the following images files inside the project folder. We will take a look at how to create the following multistate images later:

We will have three types of buildings in this game. They are Power Supply, Coins Generator, and Merchant. We'll create the following new file to store some building data:


We will include its code inside the index.html file and place it before the code of the game.js file...