I'm working on a top down game, i have items to be picked up that are spawned randomly around the layout. The problem i keep running into is that they sometimes spawn "on top of" each other. This causes problems:
1: looks tacky(bad)
2: bigger objects cover up smaller ones.
Is there a way to spawn multiple objects "at random" while avoiding Overlap?
Thanks in advance.
Run another event that checks if the objects are overlapping. If they are, pick one instance and destroy it, then recreate it elsewhere.
The only issue you'd face with this is that if the player ever sees the items spawn, then they have a chance of seeing the overlapping items for a single tick. To circumvent that issue you could give your items a fade in, active from the start, that is almost instant. That way they'll be invisible when they spawn for just a few ticks.
Example capx.
Hey, thanks for the reply.
I tried to open your link, but C2 is telling me that it was made with version 125, and mine is 119.
I'm looking on the site, but i'm not finding 125...?
Thanks for the logic though, I'll try it out.
[url=https://www.scirra.com/construct2/releases]https://www.scirra.com/construct2/releases
Develop games in your browser. Powerful, performant & highly capable.
lol yeah, i just found it as you posted. Thanks though!