Skip to main content
  • 1647 Accesses

Abstract

In this chapter, you learned how to implement a program to support the building of a maze of walls and to store it on the local computer. You also learned how to create a maze travel game. We used the following programming techniques and HTML5 features:

  • programmer-defined objects

  • capturing key strokes; that is, setting up event handling for key presses, and deciphering which key was pressed

  • localStorage for saving the layout of the walls of the maze on the player’s computer

  • try and catch to check if certain coding is acceptable

  • the join method for arrays and the split method for strings

  • mouse events

  • mathematical calculations for determining collisions between the token and the walls of the maze

  • radio buttons to present a choice to the player.

The use of local storage was fairly intricate for this application, requiring the encoding and decoding of the maze information. A simpler use might be for storing the highest score or the current score on any game. You can go back to previous chapters and see if you can incorporate this feature. Remember that localStorage is tied to the browser. In the next chapter, you will learn how to implement the rock-paper-scissors game, and how to incorporate audio in your application.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD 34.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2010 by Jeanine Meyer

About this chapter

Cite this chapter

Meyer, J. (2010). Mazes. In: The Essential Guide to HTML5. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-3384-8_7

Download citation

Publish with us

Policies and ethics