How to spawn objects in a pattern within a certain area?

I want to spawn grass objects with ysort. To do this, instead of placing each and every tuft, I considered spawning randomly, but I think that would need a number of all the tufts I wanted placed, and that wouldn’t be much better because of all the math. So I want to span grass tufts in an isometric grid sort of pattern, which would repeat within a given area. How can this be done?

Can you add more details. Especially, this part? A picture or drawing of the game might help.

Maybe, you can use external layouts and add a random set. IDK. Your concept is still a bit vague to me.


If I said spawn this many tufts in this area, I’d have to decide exactly how many tufts I wanted to spawn, and they may not spawn evenly.

This is the best I can do.

And you make a scene number variable called counter, set the number to however many times you want the cycle to repeat. Make sure not to do too much grass because I think It might freeze the computer.

I don’t know if this is the best way but there’s a noise generator extension.

https://wiki.gdevelop.io/gdevelop5/extensions/noise/

I made a little test example.
Try me. The top slider controls the density and the bottom changes the random seed number.

https://gd.games/keith_13579/witty-porter

At the beginning, you add a generator
You use 2 repeats to create a grid using X and Y.
I used the new local variables but they can be scene.

The first slider is setup with
Min = - 1
Max = 1
Step size = .01

It uses compare 2 numbers to compare the noise

Noise::Noise2d(“grass” , X, Y)

To the slider and creates a blade if the noise is greater than the first slider it adds a grass or for my test a block.

The second slider simply sets a random seed. You can use any range of numbers. It just needs a seed value. This allows for the sequence to be repeated.

The size can be adjusted. The steps and number of repeats. You could use variations by using different colored grass or change the size.

1 Like

this is exactly what i’m looking for in this, i think.