Hi
I have enemies that have a target position(the player) the player dies and the game crashes, obviously due to the enemies not having the player on screen anymore, i tried setting the target to null and a catch
if target == null:
return
but it doesn't return or doesn't return fast enough and is still looking for the player, then i get the error below
Invalid get index 'position' (on base: 'previously freed instance')
i do struggle with signals but i did think the idea behind signals is that when they do not couple objects and if the objects not there then they disregard and don't continue
so i set up a signal with the function below and as soon as the player dies i get the Invalid get index 'position' (on base: 'previously freed instance') again!
func _my_signal():
self.position = target.position
where am i going wrong??
Thanks to anyone that can help.