Book Image

Mastering Android Game Development

By : Raul Portales
Book Image

Mastering Android Game Development

By: Raul Portales

Overview of this book

Table of Contents (18 chapters)
Mastering Android Game Development
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
API Levels for Android Versions
Index

Playing music


The other type of sound that a game contains is background music. These tracks are usually longer than the sound effects and are played in a loop. In some cases there may be more than one track, for example, if we want a music for the menu and another one for the level, or if we want several levels with different background music tracks. We will work with a single one, but it is very easy to extend it to multiple tracks.

We are going to use MediaPlayer to play the background music in our game and we are going to abstract it via SoundManager as well, providing methods to pause and resume the music when the activity is paused and resumed.

Obtaining music

As with sound effects, we need some tracks to work with. When it comes to making games on a budget, one of the best places to look for music that can be used for free is Jamendo.com. There are lots of albums under Creative Commons license, some of them very reasonably priced when it comes to using them to make commercial products...