Why aren't both enemy objects spawning?

Before proceeding, please use the forum search feature at the top of the page to check if your question has already been answered.

How do I…

spawn enemy1 and enemy2 on spawnpoints1 and spawnpoint2

What is the expected result

I have a global boolean named “wave2” set to false, and a global boolean named “istrue” set to false. When wave2 is false (enemy1) the second wave of enemies(spider) has the “isture” AND “wave2” booleans that waits until the global score reaches x amount. When the global score reaches x amount it triggers istrue which should spawn both enemy1 and spider on the corresponding points.

What is the actual result

Right now, only enemy1 is spawning after wave 1. If I run the game with only enemy2 spawning it works the same for just enemy1. If I try to spawn both, only enemy 1 spawns after both waves should be running. I can only post one screen shot but if you need any more info let me know. Thank you!

Related screenshots

Project files (optional)

Insert a minimal game showing your issue in a .zip or .rar.

Hi @nevank

From what I can see, the problem is that the timer keeps resetting at 5 sec when spawning wave1, never reaching 8 sec to spawn wave2. I think you need to add a condition to only reset the timer at 5 sec when “istrue” is set to false.

1 Like

Hey there @insein ,

I created a sub-event with that code. This does seem to spawn both at the same time but now the problem seems to be that the first enemy doesn’t have a timer to stop spawning the enemies. There is just a bunch of Enemy 1 and a normal amount of Enemy 2. How would I change my code to make it so enemy 1 spawns normally without the use of the time action that was moved to a sub-event? I also tried creating another scene timer for the second enemy(spider) and that didn’t seem to work either.

Looks like I got it working by adding two different timers arranged correctly.

Thanks for the help!

By adding a “Trigger once” condition.

If you don’t want 2 independent timers so that wave2 will always spawn exactly 3 seconds after the first, then I think it’s better to keep one timer and add trigger once.

I also tried that, even when the timer is on its own sub-event with a false boolean and a trigger I still need the same timer for both enemies and I run into the same problem when wave 2 starts. I’m okay with 2 timers, I can utilize them both at some point. Thank you! :slight_smile:

1 Like