The problem I am facing is how to make a predefined number of enemies appear.

Godot Version

Godot Engine v4.5.1.stable

Question

I am developing an endless shooter with several waves of enemies. The problem I am facing is how to make a predefined number of enemies appear. To do this, I am using a timer to make the enemies appear but I don’t succeed in increasing the number of ennemies. I manage to change from 3 to 5, but after the number of ennemies never changes even if I change the number in the code.
Here is the code I am using:

Your new_game function will immediately set the score to be 12 and simply start both the MobTimer and the StartTimer once, and that’s it.

1 Like

Also, your start_new_wave() function should look like this:

func start_new_wave():
	for enemy_amount in enemy_per_waves[current_wave]:
		spawn_enemy()
		new_game()
	current_wave += 1

=+ 1 would set it to 1 every time. To increase it by 1, it needs to be += 1. And if this is inside the for-loop, it will happen per enemy, not per wave, so it should happen outside of the for-loop.

1 Like