Lab = Make Some Noise
Note: If you tried this lab on or before 8/29/2013, there was an error in the original code. Please download the code again.
- Run the Jaalaga starting code on a device
- Pick different sounds
- Update the credits screen if you use different sounds
What You Will Need
- The same setup from Lab = Display Something
- Jaalaga starting code from Git Hub
- Version 0.3
In Lab we setup a development environment. Our development environment at this point includes several software tools, the AndEngine source code and our Android or Kindle Device. Among the code was a project with a wide variety of AndEngine examples. You should have reached a point where you ran these examples on your device. If you did not reach this point you should get Lab working before tackling this lab because it requires a working AndEngine setup.
In this lab we take what we accomplished in lab and add some excitement with some sounds. Audio is an important element to a game because it can is another way to convey to the player what is going on in the game world. Tense music and sound effects can add an extra level of challenge to any game. In the interest of keeping these labs shorts, we will focus our audio efforts on replacing existing sounds.
Run the Starting Code for Lab 3
First you will need to get the starting code from Git Hub at the link described above. Add this project to your working setup from Lab. Note, if you changed the graphics in the previous labs, you can update just the “src” folder and the “assets/sounds” folder. Compile and run the code. You should now hear sounds when a missile is fired or when a missile collides with an enemy. If you are happy with the sounds, you are done!
Update the Sounds
The source code for this lab and future labs will be marked with comments that have TODO at the beginning. This lab has x such comments
The player missile fire sound is a creative commons attribution sound. Therefore the sound shows up in the credits. Here is the original sound: http://www.freesound.org/people/bubaproducer/sounds/151022/ This file is saved as playerFire.mp3 and is stored in /assets/sound/
The collision sound is another creative commons attribution sound. It is also listed on the credits scene. The original sound can be found here: http://www.freesound.org/people/Robinhood76/sounds/187647/ This file is saved as enemyExplosion.mp3 and is stored in /assets/sound/
If you want to use different sounds, replace the mp3 files mentioned above to a file with a different sound. Make sure they are fairly short because the audio pool is a small, finite size. If you load a sound that is too big to fit into memory, AndEngine will simply not play the sound.
Update the Credits
See the new file JaalagaCredits.java for code that displays the credits screen. When using sound from FreeSound.org, or any source, you should comply with the license terms. Attribute means give the author credit. Non-commercial means you can’t use the sound if you intend to publish an app for profit. Honoring license terms is the right thing to do as a content creator. If you can’t or don’t want to comply with the license terms, simply don’t use the work.