Position of random dropped coins

I need to create some coins on the ground when the enemy dies.
my problem is understanding how to randomize the fall and not have them all overlap in a single position

Not RandomFloatInRange
RandomFloatInRange is for decimals like (1.4,8.3)
Where RandomInRange(1,8)

Next thing
When you have same objects there is no easy way to separate them
Since if you would make event to separate them and one object would be moved then gdevelop will not know which coin to move and which to act as wall

Another thing
When you use RandomInRange then you ask to use random number from between minimal number and maximal number
BUUUUT it still can pick same number multiple times
That’s why they overlap
You would need to pre determine X position for few coins
Like idk 5
But not always spawn 5

I would say this even with overlapping looks more natural
Shoot with LMB and tell me do you want it instead

They should be randomly being placed on the X axis, perhaps increase the distance slightly (maybe too small to noticeably see a gap) and randomize the Y pos as well?

hi guys, I managed to solve the problem by adding variables to all the enemies and this is what remains of the code

1 Like