Hello Godots,
Okay, so I'm about to but the final touch on my first ever Godot game. A simple 2D top downer. Anyway!
So, in this game I have a Player-scene from which I can queue_free() some enemy spawnPoints objects in the game.
The very same spawnPoints are used in my GameScene-scene where a function is spawning enemies from those spawnPoints. I've made an @export array and added the spawnPoints manually from the Inspector. During a game, every 10th second an enemy is spawned from one of these spawnPoints via a timer (they are spawned from the GameScene-script).
So - during a game session, some of these, if not all, spawnPoints are removed as part of completion of a level. However, as soon as the GameScene-script is trying to add an enemy from a previously freed spawnPoint the game crashes, obviously.
I cannot wrap my head around how to fix this. I thought maybe when I queue_freed() a node it was also removed from any arrays it might had been in, but this does not seem to be the case.
Can anybody point me in the right direction here?
Thank you in advance!
All the best,
theloneswiftman