Now that we have an understanding of how to get SDL Audio to work on the web, we can start adding sound effects to our game. We will not be using a mixer in our game, so only one sound effect will play at a time. Because of this, we will need to classify some sounds as priority sound effects. If a priority sound effect is triggered, the sound queue will clear, and that sound effect will run. We also want to prevent our sound queue from becoming too long, so we will clear our sound queue if there are more than two items in it. Do not fear! I will repeat all of this when we get to that part of our code.
Adding sound to our game
Updating game.hpp
The first thing we will need to change is our game.hpp file. We need to add a new...