Skip to Main Content
Learning XNA 3.0
book

Learning XNA 3.0

by Aaron Reed
November 2008
Beginner content levelBeginner
510 pages
16h 24m
English
O'Reilly Media, Inc.
Content preview from Learning XNA 3.0

Adding a Power-Up

You've done well here—you've built your first 3D game, complete with scoring and increasingly difficult levels, and packed with a ton of fun! Before we end this chapter, though, let's do one more thing. Not that games are boring, but anything that breaks up the monotony of regular gameplay goes a long way toward making a game even more exciting and addicting.

In this section, you'll add a power-up feature that will be awarded when a player gets three consecutive kills. The power-up will let the player shoot in a rapid-fire mode for 10 seconds. I know...that sounds really exciting, so let's get to it.

First, you'll want to add a sound effect that you'll play when the rapid-fire power-up is awarded. With the source code for this chapter, in the 3D Game\Content\Audio folder, you'll find a sound effect called RapidFire.wav. Copy that file to your project's Content\Audio directory in Windows Explorer. Remember not to add the file to your project in Visual Studio because you'll be adding it to your XACT project file.

Open your XACT project file from within XACT, add the RapidFire.wav sound to the wave bank, and create a sound cue for that sound. Then, save the XACT project file and close XACT (see Chapter 5 if you need more help editing an XACT project file).

In addition to including an audio sound effect when the player receives the power-up, it would be a good idea to include a text indicator. This will help alleviate any confusion as to why all of a sudden the player ...

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.
Start your free trial

You might also like

Learning XNA 4.0

Learning XNA 4.0

Aaron Reed
Beginning C# 7 Programming with Visual Studio 2017

Beginning C# 7 Programming with Visual Studio 2017

Benjamin Perkins, Jacob Vibe Hammer, Jon D. Reid

Publisher Resources

ISBN: 9780596154905Supplemental ContentErrata Page