Skip to Content
JavaScript for Kids
book

JavaScript for Kids

by Nick Morgan
December 2014
Beginner content levelBeginner
336 pages
6h 32m
English
No Starch Press
Content preview from JavaScript for Kids

Chapter 11. Find the Buried Treasure!

Let’s put what we’ve learned so far to good use and make a game! The aim of this game is to find the hidden treasure. In this game, the web page will display a treasure map. Inside that map, the program will pick a single pixel location, which represents where the hidden treasure is buried. Every time the player clicks the map, the web page will tell them how close to the treasure they are. When they click the location of the treasure (or very close to it), the game congratulates them on finding the treasure and says how many clicks it took to find it. Figure 11-1 shows what the game will look like after a player clicks the map.

Figure 11-1. The buried treasure game

Designing the Game

Before we start writing ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

JavaScript For Kids For Dummies

JavaScript For Kids For Dummies

Chris Minnick, Eva Holland
JavaScript Projects for Kids

JavaScript Projects for Kids

Syed Omar Faruk Towaha

Publisher Resources

ISBN: 9781457189838Errata Page