Learning Objectives

We are nearing completion of our game. At this point, we have sounds that are triggering, we have considered issues related to accessibility, and have our first quest nearly complete. We are now going to add some flare by adding a recorded voice over into our game.

You will:

  1. Learn about recording voice overs
  2. Learn more about scope and fields
  3. Practice using the Audio class

Record Your Voice Over (15 minutes)

As a first step, use Audacity again, this time to record yourself saying the lines of your non-player character. Feel free to ask friends or family to record other voices, or a back and forth, if it makes sense for your game.

Trigger the sound for the nonplayer character (15 minutes)

Once you have recorded your voice over, using the same code we used for sound previously, remove the output statement from the NPC code and replace it with a call to play your voice over. This should provide a sound when you press the key instead, adding a level of immersion for your game. It is not required, but consider adding the spatial audio commands to move the sound for the NPC to one channel or another.

Add a Field (5 minutes)

In order to keep track of how many items we have collected, we need to use an integer field variable and place it into our game. This field should go write under the line of code for the class, which tells Quorum it is available in all actions. This field might look something like:

class MyGame is //etc
    integer itemsCollected = 0

Increase the Count (10 minutes)

Whenever an item is collected, we need to increase the value of this variable by one. In our collision listener, we should add code that increases this value.

Trigger the End of the Quest (15 minutes)

Once the count of the variable is equal to the number of items in your scene, the quest is done. Complete the following to finish the basic template for our game:

  1. Use a conditional to check if the quest is completed in each collision.
  2. If the quest is completed for the first time, trigger a second voice over and make the monster appear
  3. If you wish, have the monster use a second voice over with hideous laughter at the insidious fool that tried to complete the unholy quest of doom.

Next Tutorial

In the next tutorial, we will discuss Complete our Quest, which describes completing our quest..