Adding Sound
Driving a tank around, shooting these bullets off, and yet never hearing a sound would be somewhat strange, I believe you'd agree. Although you don't focus on any in-depth sound functionality for this game (you do some more for the next game), unlike in Blockers, having no sound at all would be terrible. Besides, it's the perfect opportunity to introduce the basic sound concepts now.
First, you add a reference to the sound libraries to your project. In the Add References dialog, add the reference to Microsoft.DirectX.DirectSound.dll now.
In keeping with the theme, create a new code file called soundengine.cs and add it to your project file as well. It will be the main source of sound for your game. Look at the basic implementation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access