Spawn inside area approach
I'm looking to get some ideas on how to change my current spawn system to allow for more flexibility.
At the moment, in my 2D top-down game, I have a spawn system that uses the resolution of the game it's running at to find a random spot through a raytrace and spawn a pickup if it doesn't hit a blocker.
Each level will be of various size (but always inside the max resolution of the game), there are hand placed blockers and objects that also break after a while, which after breaking needs to prevent spawns in that area. Now, the question is: what approach would work best here?
I was thinking of two different solutions that could work;
1. Expand the current system with ray tracing to detect if breakable objects have broken (can you change an object to detect a trace in runtime?) and fill the level within the screen resolution with objects that block the trace
2. Make a spawn system that utilize something like a CollisionShape2D (manually placed, cutting out places of blockers etc) and spawn things inside that (would still have to detect things that have broken so nothing spawns there)
Any help is appreciated!