In this project, we'll finish up development of our Alien Intruders game by adding sound.

The hardware setup for this project should be the same setup that was completed for the project. Here's a reminder:

The very last step to completing our Alien Intruders game is adding sound/music to our game.

First, we import our sound functions and initialize variables that hold our notes and music:

Next, we insert the sounds at the various points in the program where they make sense. Specifically, when we fire a missile, when the aliens move and when an alien is hit by a missile.

Let's insert those code snippets into our full project, and we have a completed Alien Intruders game!

Here is what the final code for this project should look like (with new changes highlighted with arrows):

  1. The small unamplified speaker that's in the kit is much better at producing high frequency sounds than low frequency sounds. Change the Notes in the game to be two octaves higher.

  2. We used sounds "fire.wav" and "hit.wav" for the missile firing and explosion sounds. Can you change these to animal sounds?

  3. Can you add another sound that occurs when a missile falls off the screen without hitting any aliens?

  4. Start the aliens one row lower. Periodically, add a single alien dot that moves across the top of the display from left to right and then disappears. — this was a part of the original Space Invaders game.

  5. Run multiple levels of the game, where each levels starts faster. At the end, display a score of how many levels were completed.

  6. Change the controller to use left an right buttons instead of the accelerometer to move the spaceship.

  7. Invert the controller to make a harder game — when the player tilts the kit left, move the spaceship right, and vice versa.

  8. Do your own variation on this game, or create your own — the sky's the limit!