Game Development Reference
In-Depth Information
java.lang.Object
> java.net.
URL
The second step in our implementation of our six AudioClip objects is the declara-
tion of six
private
URL objects named iAudioFile0 through iAudioFile5 at the top of
the InvinciBagel.java class using a compound declaration statement, which can be seen
in
Figure 15-12
, and looks like the following single line of Java code:
private
URL
iAudioFile0, iAudioFile1, iAudioFile2,
iAudioFile3, iAudioFile4, iAudioFile5;
Figure 15-12
.
Add a private URL compound declaration statement for the iAudioFile0 through iAudioFile5 URL ob-
jects
As you can see in
Figure 15-12
, you will have to again use the
Alt-Enter
work pro-
cess, and select the “Add import for java.net.URL” option, and again have NetBeans 8
write your URL class import statement for you.
Now we are ready to write the Java code that loads our URL objects, and then uses
these to instantiate our AudioClip objects. To maintain our high level of code organiza-
tion using custom methods inside this class, let's add a
loadAudioAssets()
method into
our .start() method next, and then create a
private void
loadAudioAssets() method to