O'Reilly logo

HTML5 Game Development by Example : Beginner's Guide - Second Edition by Makzan

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action – adding sound effects to the Play button

We will start with the code example available in the code bundle. We will have a folder structure similar to the one shown in the following screenshot:

Time for action – adding sound effects to the Play button

Perform the following set of steps to add sound effects to the Play button:

  1. The index.html file contains the basic structure of the HTML. Now let's add the following code to the body section of the index.html file:
     <div id="game"> <section id="menu-scene" class="scene"> <a href="#game"><span>Play</span></a> </section> </div> <audio id="buttonover"> <source src="media/button_over.aac" /> <source src="media/button_over.ogg" /> </audio> <audio ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required