How do I make a enemy wave system

basically I’m trying to make a top down rogue like game and ummm and how do I make a wave system so basically i can configure the speed, health, enemy amount per wave, and spawn time, and then I could make a custom signal to say that the wave is over and start next wave so how can I do this

If you are using GD Script then you will want to have some sort of constructor for the wave if its something that isnt fixed at runtime.

You would then create a new ‘wave’ class which in turn would then instantiate the wave objects themselves.

Or you could create predefined array of dictionaries with the data set as defined waves and then choose a random one.

ummm I don’t wanna read a entire documentation and quit reading it midway

The linked doc points to overriding _init specifically, I don’t think this is particularly relevant, and leads to more errors than solutions, but you should be prepared to read if asking for help.


I think extending a Resource may help you get started, you can make resources for each wave, then using an array of these "Wave"s iterate through and spawn them.

As an example you asked to change the enemies speed, health, and amount per wave, so you may have a wave resource like so. You can load this elsewhere to load and instantiate the enemy_scene, then apply your settings from the resource.

extends Resource
class_name EnemyWave

# a number of same-type enemies
@export_file("*tscn") var enemy_scene: String
@export var health: float = 1.0
@export var speed: float = 1.0
@export var count: int = 1

Your wave spawning script would use an Array of these waves, if exported you can fill in waves from the editor.

extends Node2D
@export var waves: Array[EnemyWave] = []
1 Like

what’s that and also I haven’t learned classes yet so uhhh ye

class_name marks the script as a static type, other scripts will have better auto-complete when dealing with this type. It also makes creating new resources easier from both the filesystem and properties.

extends is required for most scripts, it defines what properties and methods this script inherits. In this case extends Resource results in a different script from one that extends Node, specifically one that creates an easy to use data type to pass between nodes.

Have you completed this tutorial?

1 Like

well I watched like half of brackeys GDScript tutorial watched the entire thing of brackeys Godot intro tutorial and also I was saying where u got the resource thing not the extend thing

Resource is a type just like Node is, Resource is a basic type that can be extended. Nodes can make great use of Resources, for example a Sprite2D node uses Texture2D resources.