Skip to main content

Rock, Paper, Scissors

  • Chapter
The Essential Guide to HTML5
  • 1669 Accesses

Abstract

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.

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). Rock, Paper, Scissors. In: The Essential Guide to HTML5. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4302-3384-8_8

Download citation

Publish with us

Policies and ethics