O'Reilly logo

HTML5 Game Development HOTSHOT 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

Adding sound effects

In this task, we will add sound effects to the game.

Prepare for lift off

We want to ensure that the SoundJS library is ready in the vendors folder. If the file is missing, we can find it in the CreateJS website or the code bundle.

We also need to have the following sound effects files prepared in the audio folder. There are sound effects to start the game, click on a button, trash sushi, and earn money.

Prepare for lift off

Engage thrusters

In the following steps, we will add sound effects to our game:

  1. Let's begin by loading the audio file. We add the following sound-loading code into the game.js file:
    game.load = function() { // begin loading content ...

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