Time for action – building a sound effects manager
- Download the
0669_05_AUDIOPACK.zip
file from the book's website and extract the files to a temporary folder. - Right-click on the content project in Solution Explorer and add a new folder called
Sounds
. - Add the
.WAV
files from the audio pack temporary folder to your newSounds
folder in the content project. - Add a new class to the Asteroid Belt Assault project called "SoundManager".
- Add
using
directives to the top of the SoundManager class file:using System.Diagnostics; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Audio; using Microsoft.Xna.Framework.Content;
- Modify the declaration of the SoundManager class by adding
public
static
before the declaration:public static class SoundManager ...
Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.