Game Development Reference
In-Depth Information
Figure 15-10 . Use your file management software to copy the six .WAV files into the InvinciBagel/src project folder
Now we're ready to get back into Java 8 coding. First, we will add code in our In-
vinciBagel.java class in order to implement six AudioClip objects, which will reference
our audio assets, and later, in the Bagel.java class, where we will utilize the assets in a
new .playAudioClip() method that we will add to our Bagel class's primary .update()
method.
Adding Audio to InvinciBagel.java:
Using AudioClip
The first thing that we need to do to implement the AudioClip sound engine is to de-
clare six private AudioClip objects, using a compound declaration statement at the top
of the InvinciBagel.java class. I will name these iSound (stands for InvinciBagel
Sound) zero through five, as shown in Figure 15-11 , using the following single line of
Java code:
private AudioClip iSound0, iSound1, iSound2, iSound3,
iSound4, iSound5;
 
 
Search WWH ::




Custom Search