Game Development Reference
In-Depth Information
if(!goRight)
{
for(var myEnemy:GameObject in
enemyList)
{
if(myEnemy)
{
myEnemy.transform.Translate(Vector3
(-vel,0,0));
}
}
}
}
4. Finally, in the Update() function we check if a collision with the
levelBound tag occurred to change the movement direction of the swarm
and lower their height with regards to the player's ship.
function Update () {
if(bCollide)
{
goRight=!goRight;
for(var myEnemy:GameObject in
enemyList)
{
if(myEnemy)
{
myEnemy.transform.Translate(Vector3
(0,-4,0));
}
}
bCollide=false;
}
}
Search WWH ::




Custom Search