The Essential Guide to HTML5

(Greg DeLong) #1

ROCK, PAPER, SCISSORS


Summary


In this chapter, you learned how to implement a familiar game using features of HTML5, JavaScript, and
CSS, along with general programming techniques. These included


  • styles, in particular the font-family property

  • form and input fields for displaying the score

  • event handling using addEventListener for the mouse click event

  • animation using setInterval and clearInterval

  • audio elements for sound and source elements for working with different browsers

  • getElementByTagname and play for specific control of audio clips

  • programmer-defined objects for drawing programmer-created buttons on the screen, with logic
    for determining if the mouse cursor was clicked on a specific button

  • arrays of arrays for game rules


The next chapter describes another familiar, childhood game: Hangman. It combines techniques of
drawing on canvas and creating HTML elements using code that you have learned in previous chapters
along with some new CSS and JavaScript features.
Free download pdf