Hello,
I am working on a procedural dungeon crawler with pre-made rooms connected by generated hallways. The way I intend to spread the rooms out is to move them into a new random position if they are touching another room until all rooms are placed in a way so that none are overlapping.
I have placed area2d nodes with a collision shape and am using the following code to detect collisions:
if str($Area2D.get_overlapping_areas()) != "[]":
I then have some code to position it randomly. The above line was in _process() function which is not ideal but I am unsure of a better way. My problem was that since the code was the same in the two rooms, both rooms would move to a new position, then hit another room and teleport again and so on. It eventually settled down but would sometimes take several minutes to do so...
My question is if there is a faster way to get all the rooms to an unoccupied location, or at least get them to settle down quicker.
Thanks!
Kaileh57