How do i randomly spawn enemies in a specific area

im making a game in which u have to hit zombies with your car. originaly i just put zombies in the level, but now id like to make it random. if anyone can help me that would be awesome. here is my game so u can play and see

i tyed to do something like that but it wont work. could u give me an example?

also definatly look at the code

also another thing, when u restart the game for a third time, u cant see the start button, why is that?

This is a pretty good game.
You can try using a random set one to the X and one to the Y of the position.
The min and max needs to be the width and height of the game separately.

i got it to work, but its only spawning zombies at x0, y-3. can you help me trouble shoot? wierd thing is, is that when i play the code, im seeing random nubers that are in the playing space, but when i go to play the game, they only spawn at that exact point i just mentioned.

You are close, but to spawn something at a specific point, you need to first set the x & y, then trigger the spawn input.

Also, keep in mind that the x & y spawn inputs are pixel positions, not grid positions. If you wanted to e.g., spawn a zombie at grid position (4,2), then you would do the following:

set the Spawn block x input to 128 (4 * 32)
set the Spawn block y input to 64 (2 * 32)
trigger the Spawn block spawn input

thx alot. so can i only spawn things at a certain position, or can i spawn things at random positoins?

Ok, I think I found a way that will help but its adding a bit that may get complex.

I made the zombies spawn above the car just above the screen and anywhere across the screen.
I added an extactor the the car to always see its Y position and messaged it to the spawner.
The second timer is set to 1 just for a small delay so that they do spawn after the X and Y input.

Random is set min: 0 and max: 530
Expression is set A: 0, B: -250, and out = A+B

(I aslo put a message to the click in car to the start on timer in spawner. To not start spawn unless started)

i tried this, but it doesnt work

I should’ve had a little more detail on the timers,
the first timer needs to repeat forever and the second on a 1 repeat

Then it should work