Time for action — Let's add some sound

What game would be complete without sounds? None! Could you imagine playing Uncharted with no voice overs, or the incredible soundtrack? Or Portal without the witty dialogue of GlaDOS? Even the small sounds that you hear - a bird chirping in the background of an immense mountain range, or objects flying by you as they emerge from an explosion - without all these effects, games just wouldn't be complete, would they? So, let's add some to ours!

  1. We are going to add some music and a dying sound effect into our level. Search for a sound effect and a song you like; GameSalad reads a bunch of formats including MP3 and WAV and then it converts them to OGG. This is great considering that earlier versions didn't read any other format, you had to import OGG files. Import your sounds the same way you imported your images (click the + button, or drag them in from Finder), in the Library select Sounds instead of Images. You will be asked if you want to import the file as a sound effect or music; select accordingly.
    Time for action — Let's add some sound
  2. Let's trigger both of these. One will be for the background music, and the other will be the death sound effect. Double-click your Player actor, expand the Player Death group, and add the Play Sound behavior.

    Tip

    To save yourself the time of dragging in this actor and scrolling through a list of sounds, you can drag the sound effect directly into the open actor. Doing this, will create the Play Sound behavior with the sound effect selected. Easy huh?

    Time for action — Let's add some sound
  3. Select your sound effect from the list. You can tweak the settings to your liking, volume, pitch, and so on... The Positional Sound setting is great if you want a sound to get louder as you approach it, such as torches or gunfire.
  4. We can do the same for music; drag in a Play Music behavior wherever you like (but not into a rule - we want the music to start right away and not have to be triggered) and select your music file, which you can choose whether to loop or not.
  5. You can now test your level and see how everything plays out. If you followed everything correctly, you will now hear music and also a sound when you die. Your game is really coming together, but let's make it a little snazzy! Particle time!

What just happened?

In this section, we made our game much better by adding some sound effects, and as mentioned in the introduction of this section, what game would be complete without them?

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.138.122.11