How to spawn enemy

Pretty simple really. I want enemies to spawn at random times and random spots.

Object name is called spawner.

You could have two Random behaviors that select coordinates between two places. Let’s say you want an enemy to spawn between coordinate 0,0 and 2,2. Set up each random behavior so that it chooses between 0 and 64 (Since every block is 32 pixels, and to use the spawn, you have to input the pixels) and it will randomly spawn an enemy within those coordinates. Although depending on what you plan on doing, you might want to increase that number, pick to coordinates you want enemies to spawn and multiple each number by 32 and add that to the random. You should have one random for X coordinates and another one for Y. Each one should be put into the inputs of the spawn behavior. Then have a timer or a trigger to spawn the object or enemy. Hopes this helps.

1 Like

This sounds hard for me but ill try

Well, I’m not very good at explaining things, but I’m sure @JR01 would be glad to help out and explain this into further detail.

1 Like

I have used emit behaviors, and made them never disappear. I have used this on one game, but I will not tell you the game yet because it is still a work in progress, and my team has been working hard on it.
I am not sure when it will come out. But the emit doesn’t work as well for random spots, unless you have blocks and randomize messages to blocks all around the game. I will see if I can work something out…

Well it spawns but it spawns at the at same place every time. And if i separate the random blocks, the enemy dont spawn at all.

You have to put the random block output into the x or y input on the spawn block :upside_down_face:

1 Like

I did do that. But sill didn’t work.

That’s good but you have to wire something into the spawn input. Maybe use the timer that goes into the random blocks? :upside_down_face:

Use the bottom random for spawn input too.
Spawn needs to be the last input to work, the last input (y) will also work.

Also 0-64 is not far, spawn only works in pixels.
If you want to go by the grid, multiply the number by 32.

1 Like

This is my first two weeks in flowlab and i have no idea what you mean by multiply 32. Im good at math but this is different. So sending screenshot would be better.

The Range in the Random block is 0 - 64.
64 pixels is only 2 grid cells long (which each grid cell being 32 pixels).

But if you want to go 64 grid cells long,
then the range in the random block would be 0 - 2048 (64 x 32).

Again, the Spawn block only works in Pixels

1 Like

Stilll didnt spawn

You have to hook something up to the “Spawn” input on the spawner, like the timer, so it puts in the coordinates, but it does not have the signal to actually spawn the zombies.

1 Like

Oh.

1 Like

Good job! I have a suggestion for the mouse too, I think you should add this:
image

Actually, that is incorrect, put the “always” behavior and hook it up to the “Off” output.

AaAaHhH Yes much better.

1 Like

If they are spawning weird, use the bottom random block for spawn instead.

2 Likes