mercredi 21 juillet 2021

How do I stop my random enemy spawner from spawning an enemy where there is one enemy already?

I made a script that spawns random enemies, randomly across a set of different predestined positions in the game. These positions are empty game objects. Also the spawner has a limit, so if doesn´t spawn more of that I want, and if the number of current enemies goes back to being less than the maximum, it starts to spawn more enemies until the limit is reached

All of this works nice and i have no problem, but the thing that is missing and I want to add to this spawner, is that enemies don´t spawn randomly in the same position, making an overlap, if in one of the possible spawn positions there is already an enemy. I want the spawner to take another position that is free of enemies, for the next one.

image of the complete code




Aucun commentaire:

Enregistrer un commentaire