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:
scripts/data.js
We will include its code inside the index.html
file and place it before the code of the...