Help with cell spawning

So I’ve been attempting a simple natural selection simulator and before I continue there’s this bug where the cells spawn at the left or top of the map, any ideas how I could fix this

Game

1 Like

You can get the X and Y value of the cell it’s spawning from, then put that in an expression (X-distance you want away, X+distance you want away. Do this for the Y value as well). Put those numbers into a Random behavior Min and Max values, then get a randomly generated X and Y value from that. Use those to spawn the next cell. Haven’t looked a your code so I don’t know whats wrong with it, but that’s how I would spawn other cells.

1 Like

Spawning at the top left (very close to 0,0) often happens from trying to use grid coordinates instead of pixel coordinates. If this is the problem, multiply your spawn positions by 32.

1 Like

After playing the game, I see you meant cell by the name of the object and not the grid cell in the editor.

The problem here is that your giving the cells adjusted x and y position but not adding this x and y for the spawn to use. As well, when spawning on the same frame as a number, use the expression that’s on bottom (usually the spawner input for Y) so that the x and y can be inputted before spawning.

image

My suggestion:

3 Likes