Chapter 9. Hangman

Hangman
  • CSS styles

  • generating markup for alphabet buttons

  • using an array for a sequence of drawings

  • using a character string for the secret word

  • an external script file for the word list

  • setting up and removing event handling

Introduction

The goal for this chapter is to continue demonstrating programming techniques and the features of HTML5, Cascading Style Sheets (CSS), and JavaScript, combining dynamic creation of HTML markup along with drawing graphics and text on the canvas. The example for this chapter is another familiar game—the paper-and-pencil game of Hangman.

Just in case you need to brush up on the rules, the game is played as follows: ...

Get The Essential Guide to HTML5: Using Games to Learn HTML5 and JavaScript now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.