Godot Version
Godot 4.2
Question
I am making a game in Godot that requires enemies to spawn and run after you. i was following this tutoriall, and am stuck on the last bit.
The code calls for one of the lines to be:var e = enemy.instantiate(). And after i put that in:
–
func spawn_enemies():
for x in range(9):
for y in range(3):
var e = Enemy.instantiate()
var pos = Vector2(x * (16 + 8) + 24, 16 * 4 + y * 16)
add_child(e)
e.start(pos)
e.died.connect(_on_Enemy_died)
func _on_Enemy_died(value):
score += value
–
Why is it saying that? What is wrong with this line “var e = Enemy.instantiate()” in my code?