Game Development Reference
In-Depth Information
//display a "You lose" message
DisplayGUI.GameEnd="THE ALIENS
DESTROYED YOU!";
//update the hiscore
if(DisplayScore.Score>DisplayScore.HiScore){
DisplayScore.HiScore=DisplayScore.Score;
}
}
//check collisions with barriers
if(other.gameObject.tag=="BarrierBrick"){
Destroy(gameObject);
Destroy(other.gameObject);
}
}
8. The player also loses if the aliens reach the bottom of the game area and
touch his ship. To keep things nice and clean, we create a new script to be
attached to the four alien prefabs, which we also use to destroy the barriers,
should they be touched by the aliens.

9. Create a new script in the Script folder, name it CheckAliensTouch and
add the following command lines:
#pragma strict
function Start () {
}
function Update () {
}
Search WWH ::




Custom Search