Game Development Reference
In-Depth Information
function moveEnemies()
{
if(goRight)
{
for(var myEnemy:GameObject in
enemyList)
{
if(myEnemy)
{
myEnemy.transform.Translate(Vector3(vel,0,0));
}
}
}
if(!goRight)
{
for(var myEnemy:GameObject in
enemyList)
{
if(myEnemy!=null)
{
myEnemy.transform.Translate(Vector3(-vel,0,0));
}
}
}
//play the aliens moving audio
audio.Play();
}
Adding sound fx to be played when the aliens and the player's ship are destroyed
poses a problem, which is interesting to discuss. The idea is to attach the audio clip
to the player's bullet so that we can play the clip when the bullet hits an alien.