Game Development Reference
In-Depth Information
pixels\frame
transform.Translate(Vector3(0,2,0));
//Y=140 defines upper screen limit
if(transform.position.y>100)
{
//destroy bullet as it goes
outside the upper
//screen limit
Destroy(gameObject);
//once the bullet is destroyed,
allow the player
//to shoot again
ControlShip.canShoot=true;
}
//destroy bullet after audio is played
if(bMustDestroy && !audio.isPlaying)
{
Destroy(gameObject);
}
}
//this function checks for collisions
function OnTriggerEnter(other:Collider)
{
//if bullets collides with aliens,
destroy both
if(other.gameObject.tag=="Enemies"){
//play the fx
audio.Play();
//destroy the alien
Destroy(other.gameObject);
//add 50 points to score for
each alien destroyed
Search WWH ::




Custom Search