How do I randomly create few object in a position where they do not collides with each others?

I tried to create the fishes, but i wish that the fishes image does not collides with each other.
I have tried as below.

Here is the random create code though.

Thanks in advance!

You’ll need a second object, the same size and shape as you Fish object (say call it fishCheck).

Place fishCheck in a random position until it doesn’t collide with a Fish object.

Create a new Fish object, at the position of fishCheck.

Repeat the process.

The reason your Fish collide with fish => delete fish didn’t work is that GDevelop can’t work out which Fish to remove, so it’ll delete them both.


I think that RandonWithSteps would probably work

Yeah, I agree with this. You might be able to make it work if you add a “pick random fish” condition, but you may still end up looping forever.