Game Development Reference
In-Depth Information
invinciBagel.gameScore
-=2
;
invinciBagel.playiSound1();
} else if(object instanceof PropH) {
invinciBagel.gameScore
-=1
;
invinciBagel.playiSound2();
} else if(object instanceof PropB) {
invinciBagel.gameScore
-=2
;
invinciBagel.playiSound3();
} else if(
object
instanceof
Treasure
) {
invinciBagel.gameScore
+=5
;
invinciBagel.
playiSound4
(); }
invinciBagel.scoreText.setText(String.valueOf(invinciBagel.gameScore));
}
Figure 17-16
.
Add a Treasure else-if structure to end of the .scoringEngine() method conditional if() structure
You will need to remember to add the Treasure objects to the
castDirector
object,
as seen in
Figure 17-17
, because the collision detection engine uses this
CastingDir-
ector
class (object) to manage a collision detection process. If you do not do this step,