1
Fork 0
mirror of https://github.com/Steffo99/swear-jar.git synced 2024-11-21 15:24:18 +00:00

Don't crash if no place to spawn

This commit is contained in:
Steffo 2023-10-02 21:27:52 +02:00
parent 0366f2cf41
commit 2efdb5ebee
Signed by: steffo
GPG key ID: 2A24051445686895

View file

@ -92,6 +92,9 @@ func _on_ghost_requested(scene: PackedScene, texture: Texture2D):
func _on_ghost_materialize():
var instantiated = ghost.materialize()
if not instantiated:
print("[Game] The ghost can't materialize; the spawning is cancelled!")
return
var spawner = instantiated.find_child("Spawner")
if spawner != null:
spawner.target = self