I'm trying to stop the Level when there are no Zombies left in the world. That means I need the number of the object Zombie, but I don't know how to do that.
For now I managed it like this:
This code ends the Level as soon as there are only two Objects (The Player and the class which manages the Levels) left in the World, which means
that all Zombies must be dead. This Way has worked for now, but I am planig to add some objects during th game, so it won't work anymore.
Any Ideas how that could work?
(Like already Mentioned, the code for the Level management is in a subclass of Actor (Mostly, because i'm not so familiar with World codes), so it would be great, if any new code could replace this one in the same class)
if(level == 1){
if(level_1_complete == false){
if(getWorld().numberOfObjects() == 2){
level_1_complete = true;
}
}
}
if(level == 2){
if(start_level_2 == true){
if(level_2_complete == false){
if(getWorld().numberOfObjects() == 2){
level_2_complete = true;
}
}
}
}

