So recently, I’ve been trying to make a 2D procedual generation mining game, each time you mine a block, other blocks appear around it, creating a seamlessly infinite cave, the problem is that rocks are spawning over other rocks and trying to check for collisions isn’t working, here’s the code I’m using and how the game looks:
Your issue is that you are selecting the pedra object that is under the cursor (which should also be the one closest to the cursor). At this point, GDevelop is working with only the one pedra in the subevents. So any collision checks are done with that one pedra object.
To resolve this, I would look at a slightly different approach:
Set BlocoX and BlocoY to the centre point of pedra
Instead of repositioning the blue blocks (debugBlocoBaixo), create 4 new ones around the mined block. This can be done in one event with 4 actions.
Create a new event to check for collision between pedra and debugBlocoBaixo, and delete debugBlocoBaixo (this will only delete the debugBlocoBaixo colliding with pedra.
Then add a “Repeat for each debugBlocoBaixo object” event, with actions that create a pedra object
Finally add an event with action that deletes debugBlocoBaixo.