Open leeanneb opened 11 years ago
Fixed Error:
function Update () { if (GameObject.FindGameObjectsWithTag("alien").Length == 0) { // if aliens are all killed it will go to the next level NextLevel();
function NextLevel() { level++; //change level 2 switch (level) { case 2: score = 0; generateAliens(3, 6); // setting the aliens this.GetComponent(SwarmController).rightmargin = 3; //setting the border break; //change level 3 case 3: score = 0; generateAliens(5, 8); this.GetComponent(SwarmController).rightmargin = -1; break; case 4: //if the player passes the level it will go to the win page Application.LoadLevel(2); break; }
I added a function "NextLevel();" so that it will go to the next level when the aliens are all hit. In this function I am arranging the alein swarm ( increasing rows and coloms when it goes to another level) and setting the background and the margin.
Error: function Update () { if (GameObject.FindGameObjectsWithTag("alien").Length == 0) {