- Home /
Spawning Statement Help
I have enemy spawner that spawns a basic enemy and a subboss, now the level increases everytime and the ships move faster after 10 ships has ran through the script. Now on level 4 i want my subboss to appears with no enemies on the screen, then after the player destroys it the level continues. Here is my script if you could help fix it thank you, question below the script.
var isON: boolean = true;
var Enemyred: Transform;
var Enemyreed: Enemy_Red;
function Update () {
if (level == 4 && isON == true){
isON = false;
Instantiate(Enemyred, Vector3(0,8,2), Quaternion.identity);
}
if (Enemyreed == null){
Enemyreed = GameObject.FindWithTag("Enemy_Red").GetComponent(Enemy_Red);
}
if(Enemyreed.health <= 0 && level == 4 && isON == false){
isON = true;
}
Now in this script it turns off the spawner so the basic enemy won't spawn while the player takes on the subboss alone. But the things that is wrong is that, it doesnt continue on to the next level which i want it to do that, also it infinitely spawns the boss so basically your stuck playing level 4 with the same boss.
Another thing is i have a collider at the bottom which destroys the boss, only thing wrong is the script stops because the boss wasnt destroyed by the player. What do I need to fix in this script so the level can continue to level 4?
Note: Saying "Turn isON to true in the beginning" will not help all it does is floods the screen with the boss