O'Reilly logo

HTML5 Game Development HOTSHOT by Makzan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Placing the defense buildings

In this task, we work on the board and allow the player to add buildings.

Prepare for lift off

We are going to need some new files, the helpers and buildings. Specifically, they are helpers.js, building.js, space-junk.js, satellite.js, satellite2.js, castle.js, and castle2.js. Create these files and include them into the HTML file. Also, note that the buildings are placed inside the scripts/board-objects/buildings/ folder:

<script src="scripts/helpers.js"></script> <script src="scripts/board-objects/buildings/building.js"></script> <script src="scripts/board-objects/buildings/space-junk.js"></script> <script src="scripts/board-objects/buildings/satellite.js"></script> <script src="scripts/board-objects/buildings/satellite2.js"></script> ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required