Geeks With Blogs

News

2004-2009
Celebrate Computer Science Education
Locations of visitors to this page
Brian Scarbeau Insights from a seasoned Computer Science Trainer

For the past several weeks, my students have learned C# and started to learn XNA by reviewing the tutorial that Microsoft MVP Bill Reiss put together on his site.

Today, we reviewed how to put sound into the game.  The XNA Creators Club has a good video on this topic. I would highly recommend using the Sound.cs file that Bill uses in his tutorial for you to create your own sounds using XACT.

You just need to change the namespace to the project you are working on and then initialize the sound under the Initialize() method and update the sound in the Update(GameTime gameTime)  method.

Finally, add your sound in your game play:

if (bounced == true)
           {
               Sound.Play("boing");
           }

My students have all kinds of sounds now in their sprite collision.

Next, we'll add sound to a 2d game that uses keyboard commands for movement. The gameplay is pretty basic but the concepts are important for students to learn. After this we'll start to take a look at the pong game.

The students have stuck with it and they are starting to learn XNA.

Posted on Monday, March 3, 2008 12:58 PM | Back to top

Copyright © Brian Scarbeau | Powered by: GeeksWithBlogs.net