These green spots are “bridge spawn points”. When I press the key Z, I want it to spawn 3 (or any number) of bridges in random spawn points. This works, but it can spawn multiple bridges in the same spawn point, leading to a situation where it looks like there is only 2 or 1 bridges. This isn’t fine. I need the later “random location picks” to exclude the first and second picks, until I press Z again (which deletes all the old bridges and creates new 3 bridges following the same guidelines.)
I first hoped repeating this 3 times in a row would work:
This works when spawning only 1 bridge at the time, so why not multiple? Well it seems like it doesn’t. It’s like the engine doesn’t consider the bridge created until a frame has passed or something? Otherwise why doesn’t the INVERTED “bridgeSpawn is in collision with bridgeLeft” not remove the possibility for duplicates?
I understand that I’m far from the first one to have problems with duplicate spawns, but all examples I’ve come across are just different enough to confuse me. That being said, I’ll keep trying and studying the examples. I probably have ot learn to use arrays and structures better. I’m sure I can do it, but I’d rather not do it in a needlessly complicated way if a more economic solution exists.
I’ll update y’all and share my solution when I find a good one :>
The inverted condition doesn’t quite work the way you think. It doesn’t mean “if bridgeSpawn is not colliding with a bridge”. But rather it means “is braidgeSpawn not in collision with any bridge”. If you have 2 bridges, and bridgeSpawn is in collision with one of them, then it’s not in collision with the other one. So the condition is true.
@Reborn’s suggestion is a good solution. To expand on it, try something like:
I’ve watched the gdevelop tutorial on object picking but I don’t seem to get it right.
Would you mind explaining in detail what I’m still missing here and how the picking works in this case?
Over all I’m unable to follow your train of thought here. I don’t understand what you are saying, I’m sorry.
Just to be clear, I only have one type of bridge. My “bridgeLeft” and “bridgeRight” form one full bridge. For all intents and purposes, you can completely ignore the existence of “bridgeRight” and treat “bridgeLeft” as the whole bridge. Just wanted to clarify this in case this caused some confusion.
This is the right way to do it. What you need to include is an action to set bridgeSpawn.isUsed to true in the events where the bridgeLeft and bridgeRight are created. Otherwise the bridgeSpawn can be selected again (because the isUsed is still false)
Ignore it, I was rambling without thinking about what I was saying. Sorry.