- Home /
Level spawning statement help
So in my script i have a level spawner that spawns 10 enemies and the level increases. On Level 4 there is a sub-boss that appears, in the script i have a trigger that can control to turn the spawner off or on. So in this instance i turn it off so the player is fighting the boss only and not the minions.
Now my question is I need help making a statement where if the boss dies turn the level thing back on. It would be great if you could link me, or even tell me the code.
here is 2 scripts one that spawns the subboss and one that destroys it, keep in mind if i remove "IsON=False" it floods the screen with enemies
script 1
var isON: boolean = true;
var Enemyred: Transform;
function Update () {
if (level == 4 && isON == true){
isON = false;
Instantiate(Enemyred, Vector3(0,8,2), Quaternion.identity);
}
}
script 2 which destroys the ship when the laser collides with it
function OnCollisionEnter(col : Collision){
if(col.gameObject.tag == "Enemy_Red"){
Destroy(gameObject);
if (enemyred == null){
enemyred = GameObject.FindWithTag("Enemy_Red").GetComponent(Enemy_Red);
}
enemyred.health -= 50;
Destroy(gameObject);
}
Two thumbs up if you help thank you
What are the enemies in this circumstance? I do not understand which is the $$anonymous$$ion and which is the boss? Please tell me what the variables mean, then I can help.
uhm there is only one variable and the boss is "Enemyred"
Your answer
Follow this Question
Related Questions
Two Objects Touching? 0 Answers
Spawner continuing after boss dies 1 Answer
I can't get Destroy(collision.gameObject) to work? 2 Answers
3D Spawn a weapon at player and swing with it once. 0 Answers
Spawning Statement Help 0 Answers