Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have four spawners in my scene that spawns four enemies. My problem is when I try to add game objects to the list it works but only for one spawner.

My code

if (Score.levelNum >=2 ){
  germtype.Remove(pupplegerm);
  germtype.Add(blackgerm);
  germtype.Add(blackgerm);
}
else if(Score.levelNum >=3 ){
  germtype.Remove(bluegerm);
  germtype.Add(greengerm);
  germtype.Add(greengerm);
}

I want to add a new enemy / germ each time the player moves up a level. I have green germ and black germ stored in a variable.

share|improve this question

Remove the else from the other conditions, as only the first condition triggers. That is because something greater than or equal to three is also greater than two.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.