Add Music and Sound Effects


Back in Chapter 13, “Creating Music and Sound Effects,” we created the music and sound effects we’ll now use for our game. MMF provides a way to play MP3 files with the DirectShow object. You can add it to the project by choosing it from the Insert an Object window, which can be displayed by choosing Insert, Insert an Object. When it is displayed, you can set the file that will be played and several other options. You can browse to the file we created in Chapter 13 and remove the options selected for displaying the DirectShow object. Although Figure 19.55 does not indicate it, there is also an option for looping the music (this was not available when the book was written), so make sure it is selected.


Figure 19.55: The DirectShow options.

We can now add the sound effects that will play when we click on the ducks. Open the Events Editor and locate the events related to the mouse clicking on the ducks. Right-click in the box located in one of the events and choose Play Sample (see Figure 19.56). The Play Sample window is displayed. You can choose the sound sample we created back in Chapter 13 (on the CD-ROM it is called “Gun Shot”) by clicking on the Browse button and then clicking OK when finished. Your sound will be played whenever this event occurs. Repeat the process for all of the duck click events.

click to expand
Figure 19.56: We need to choose Play Sample.

The final step in the project will be to display the mouse pointer we had previously hidden. Double-click New Condition to create a new event in the Event Editor. Right-click the chessboard icon from the list and select End of Application from the available options. The event is now available at the bottom of our events for the game. Our last step is to right-click the row/column intersection between our newly created event and the mouse and keyboard pointer and select Show Mouse Pointer from the two available options. That’s all there is to the application.




Awesome 3d Game Development(c) No Programming Required
Awesome 3d Game Development: No Programming Required (Charles River Media Game Development)
ISBN: 1584503254
EAN: 2147483647
Year: 2006
Pages: 168

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net