Game Development Reference
In-Depth Information
DisplayScore.Score+=50;
//once the bullet is destroyed,
allow the player
//to shoot again
ControlShip.canShoot=true;
//disable collider and put the
bullet on
//NotToRender layer
collider.enabled=false;
gameObject.layer=8;
//we destroy it once the fx is
over in Update()
bMustDestroy=true;
}
//if bullet collides with barriers,
destroy it and a
//piece of the barrier
if(other.gameObject.tag=="BarrierBrick"){
Destroy(gameObject);
Destroy(other.gameObject);
//once the bullet is destroyed,
allow the player
//to shoot again
ControlShip.canShoot=true;
}
}
You can apply a similar solution to the audio clip to be played when the player's ship
is destroyed, attaching the audio source to the AlienBullet prefab. Also, remember
to address the aliens themselves hitting the player's ship. Try to find a solution your-
self!
Search WWH ::




Custom Search