Randomized Objects with Specific Placement

I would appreciate any help with this.

Let’s say I have 6 objects “Object1,Object2,Object3,Object4,Object5,Object6”.

Let’s say at the beginning of the scene I want each one to be placed in one of 6 select X/Y coordinates.
(No more than one object in the same X/Y coordinate)

Essentially, every time the scene or game is refreshed, all 6 objects will always be in a different random position. And there won’t be any repeats, as in there won’t be 2 or more of the same object.

Any ideas on how to accomplish this?


Start with
Create a Group of All Objects
create a instance variable or Object variable called spawned or showed or is_in_screen set 0

Repeat 6
Foreach AllObjectcsGroup
if AllObjectsGroup.somevariable = 0 and AllObjects.count = 0
Do your stuff here…
AllObjectsGroup.somevariable =1

This is pseudo you have to try to reproduce this in GDevelop

see this example with placeholder

1 Like

Thanks for input UlisesFreitas and Ziko, I appreciate it.

I found a way using ideas from Lizard-13’s post. And gametemplates.itch.io’s Create a Random Object example.

There may be a simpler way of doing this, but I haven’t been able to find it, so I thought I should reply here with what I compiled, encase it helps someone in the future.

1 Like