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.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
Rights 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
DOI: https://doi.org/10.1007/978-1-4302-3384-8_7
Publisher Name: Apress, Berkeley, CA
Print ISBN: 978-1-4302-3383-1
Online ISBN: 978-1-4302-3384-8
eBook Packages: Professional and Applied ComputingProfessional and Applied Computing (R0)Apress Access Books