In the game I'm making I need a sprite to despawn after a timer has gone off. The issue is, The sprite is instanced, and the node that instanced it would be queue_free()'d at this point.
Let me explain this more clearly: After the health of an enemy teachers 0, I call the queue_free() function and spawn a sprite in its place, as the child of the previous node's owner. Now, this is all fine and dandy, but I want this sprite gone after 5 seconds, which isn't happening.
I've tried a few things: I've tried attaching a timer to the sprite, which would queuefree() the sprite after its time has run out (the script is attached to the sprite itself). I thought about autoloading a timer that would queuefree() anything with the tag "debris" but I don't know how I would specify which bodies the timer would target.
I've been thinking and searching for a solution for over an hour but I've come up on nothing. Any help would be appreciated.