The Essential Guide to HTML5

(Greg DeLong) #1

THE MEMORY (AKA CONCENTRATION) GAME


Summary ......................................................................................................................................................


In this example, you learned how to implement two versions of the game known as memory or
concentration) using programming techniques and HTML5 features. These included



  • examples of programmer-defined functions and programmer-defined objects

  • how to draw polygons on the canvas using moveTo and lineTo along with Math trig methods

  • guidance on how to use a form to show information to players

  • a method for drawing text with a specified font on the canvas

  • instructions about how to draw images on the canvas

  • using setTimeout to force a pause

  • employing Date objects to compute elapsed time


The applications demonstrated ways to represent information to implement two versions of a familiar
game. The next chapter will temporarily depart from the use of canvas to demonstrate dynamic creation
and positioning of HTML elements. It also will feature the use of HTML5's video element.

Free download pdf