having a hard time figuring out timers for spawning enemies

working on a vertical shmup game and trying to make the enemies spawn in the right order has been interesting to say the least.
if I don’t pause or reset the timer after spawning I get an infinite waterfall of enemies, so I would guess that I need to use another separate timer.
but no matter what I do to that next timer it spawns the enemies at the same time as the other ones. so like, if I wanted to spawn 2 enemies then five seconds later spawn 3 more, it would just spawn 5 at once. help please?

Something like this should do it:

After started the scene, this code will wait 1 second and create 2 enemies A, after that, it will wait 5 seconds and create 3 enemies B :slight_smile:

thank you! I was able to get it working correctly because of your advice!
although now I have a problem I wasn’t noticing before, where the first enemies are spawning right away, then spawning at the right time afterwards. so the timer is working correctly, but I can’t figure out why they show up immediately when the scene starts.

They shouldn’t, I guess there are other events moving them? :confused:

In case you are using Lizard-13’s example, 1 second to spawn the first wave is not that long. Remember that every event is triggered 30-60 times a second. You unpause the timer right after the scene loads and spawn the first wave a second later. Technically just a moment. What do you expect how long a second takes?..

But maybe I misunderstand the situation :smiling_imp:

I didn’t copy it exactly
in fact I just set the first timer to ten seconds and they still spawn right away
and I’ve double checked everything, the only event I have that makes them spawn is the timer. I don’t see any reason at all why they would be doing that.

There must be something you miss.
In case it is HTML5, try to clear browser cache and hard refresh your browser.
If it doesn’t solve the problem In similar situations when I can not see the cause of a bug especially in a big, complex project I normally create an empty project and recreate the functionality and make it work on it own that way I can be sure nothing interfere. It always helps me to find the cause.
Actually for that reason I always try to design my projects modular keep all the features as separated from each other as possible so I can simply switch on/off any feature of my projects and even replace them without causing any unexpected behaviour.

If nothing helps, make a screenshot of your events or share your project file and we can have a look.

it was native
I fixed it by deleting and remaking the event. still no idea what caused it, but at least it works right now!

There is a ghost (a bug difficult to reproduce and therefore can not be fixed) in GDevelop that sometime screw up the project file and if you are lucky you just get a weird bug or error message that can be eliminated by deleting and adding staff again as you did or create a new project and copy staff over or even open the project file in a text editor and find the error manually. But if you are not lucky your project file get corrupted and never open again and can not be fixed. It is happened to me only like 3-4 times in the past years so it is not something you going to experience daily but always make backups of your project file.

Wow, that never happened to me :open_mouth: :open_mouth: :open_mouth:
The closest thing I know about is a little bug with the C++ events, when you use C++ events there are some random letter/numbers saved in the project file that points to the temp C++ .obj file to link at, this file direction can get outdated and never compile your custom C++ events again, so you have to edit the project file manually, or copy everything into a new project with C++ working :neutral_face:

Lucky you, The first time it happened to me was pretty unpleasant, I just didn’t know what is happening, things didn’t work in my project that should have been so I created a new project to copy my events over and submit for bug report and ask for help when I noticed it works in the new project so WTF. I had to copy all my events and scenes over to the new project to get it working again. Changed nothing but created a new project and copy everything over… There must be a bug somewhere with saving the project file or saving changes rather as I experienced this problem mostly when I change something but can not reproduce it, just happens sometime… I have reported the bug I believe but Victor told “got no time to hunt for ghosts”

Since it did happened to me few more times but not very often, last time when I was rename an external event but I was able to fix it by opening the project file in a text editor and get the name of the external event right manually.