Game Development Reference
In-Depth Information
if(object instanceof PropH ) {
invinciBagel. gameScore +=3;
invinciBagel. playiSound2 ();
}
if(object instanceof PropB ) {
invinciBagel. gameScore +=2;
invinciBagel. playiSound3 ();
}
invinciBagel.scoreText .setText (String .valueOf (invinciBagel. gameScore ));
}
Figure 17-10 . Add .playiSound() method calls in each if() statement body to play different audio for each type
Now we have even more game play interaction in place, as the scoreboard will in-
stantly update correctly on each collision, and will play an audioClip at the same time,
 
Search WWH ::




Custom Search