Hi folks, I think this time I’m stumped with what I did here. I tried to recreate what was done in this lesson to a mini game I’m making and I’m now not able to spawn enemies. I am getting errors when enemies are meant to appear however no enemies appear. The error is as below:
E 0:00:03:0343 enemy_spawner.gd:16 @ _spawn_enemy(): Can't emit non-existing signal "enemy_spawned".
<C++ Error> Condition "!signal_is_valid && !script.is_null() && !Ref<Script>(script)->has_script_signal(p_name)" is true. Returning: ERR_UNAVAILABLE
<C++ Source> core/object/object.cpp:1009 @ emit_signalp()
<Stack Trace> enemy_spawner.gd:16 @ _spawn_enemy()
enemy_spawner.gd:9 @ _on_timer_timeout()
And the code is as follows for enemy_spawner.gd:
extends Node2D
var lives = 3
var score = 0
@onready var player = $Player
func _on_death_zone_area_entered(area):
area._die()
func _on_player_took_damage():
lives -= 1
if (lives == 0):
print("Game Over")
player.die()
else:
print(lives)
func _on_enemy_spawner_ememy_spawned(enemy_instance):
enemy_instance.connect("died", _on_enemy_died)
add_child(enemy_instance)
func _on_enemy_died():
score += 100
print("Score: "+str(score))