I am developing a Shoot 'em up with a spawn script for enemy waves. I spawn the enemies in a function "wave 1" called in _ready(). In this Wave-Spawn Function I create enemies with this line:spawn_enemy_group(type, amount, *time_between_enemies*, *time_after_spawning_all_enemies*)
In the spawnenemygroup-function I am using:
await get_tree().create_timer(time_between_enemies).timeout
after each enemy and
await get_tree().create_timer(time_after_spawning_all_enemies).timeout
after spawning all enemies
My problem is that the wave script will go on altough the timer in the spawn-function isn' t over yet. How can I make the wave-function wait until the timer in the spawn_enemy-function is over?