Hey all,
This is my first time attempting a rogue-like dungeon room generator, I’ve got a solid start. I have a script that spawns a random number of pre-fab rooms in random locations. The problem is, some of those rooms spawn on top of eachother, I don’t want to increase the map size.
void Start ()
{
roomsToBeSpawned = Random.Range(8, 12);
for (int i = 0; i < roomsToBeSpawned; i++)
{
Vector3 spawnLocation = new Vector3(Random.Range(minX, maxX), Random.Range(minY, maxY), 0.0f);
Instantiate(rooms[Random.Range(0, 4)], spawnLocation, Quaternion.identity);
}
}
This is what I’ve got so far and it’s working as intended. Just need a some help or a point in the right direction on how to stop the rooms from spawning on top of eachother. I should mention each room is a sprite, all 5 rooms have a different size.
Thankyou!