How can i get random objects to spawn but not overlap on eachother

I’m new to gdevelop and I’m trying to make a breakout type of game with random block generation but they keep overlapping does anyone know what i could do

I do this in my game. I have the following:

  • Repeat X times (where X is the number of blocks you want to add)
    • Create block at random position
    • While:
      • Pick all blocks
      • Block is in collision with Group (where Group is an object group that contains all the objects you don’t want to overlap)
    • Repeat:
      • Move block to random position

So basically you create a block in a random position, then in a while loop check if it’s colliding with anything and, if so, move it.

EDIT: Here’s a screenshot of what I do:

You can check the collision and then apply
Separate object