Hey there,
At the moment I have 3 possible spawn points for monsters and an array of different monsters. Right now I’m randomly selecting a monster every second round and then spawning it at one of the 3 points at random. This has been good for test purposes but it obviously wildly differs in difficulty from round to round.
I know I could make a script for every level and hand pick the monsters and placement, but I’m wondering if there is a superior way of doing this?
This is what my current spawnMonster script looks like.
void spawnMonsters() {
if (round % 2 == 0) {
int randMonster = Random.Range(1, 11);
int randNum = Random.Range(0, 3);
while ((randNum == 0 && BusyCheckLeft.LeftLaneBusy) || (randNum == 1 && BusyCheckMid.MidLaneBusy) || (randNum == 2 && BusyCheckRight.RightLaneBusy)) {
randNum = Random.Range(0, 3);
}
if (randMonster < 2) {
GameObject monster1 = (GameObject)Instantiate(Monsters1[0], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
} else if (randMonster >= 2 && randMonster < 5) {
GameObject monster2 = (GameObject)Instantiate(Monsters1[1], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
} else if (randMonster >= 5 && randMonster < 7) {
GameObject monster3 = (GameObject)Instantiate(Monsters1[2], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
} else if (randMonster >= 5 && randMonster >= 7) {
GameObject monster3 = (GameObject)Instantiate(Monsters1[3], new Vector3(randNum, 0.1f, 5), Quaternion.Euler(90, 0, 0));
}
}
}