In my game I have it where the player can collect gems - though it seems that when I collect them and then die to an enemy, the player does the die animation but does not ‘self.queue_free()’ and return to the main screen scene. I have tried to do just ‘queue_free()’ to see if that would get rid of the gems, but ran into the same issue. It does not pop up as an error in the debugger either.
Is there a simple way to code to remove items from a players inventory?
Hey @wchc, I’m jumping in since I’ve faced a similar issue. If the player or inventory holds references to objects (like collected items), queue free() might not work as expected because those references can prevent proper cleanup. In my case, I had to manually clear the inventory data before calling queue free() on the player. It seems Godot 4 handles node lifecycles a bit differently, so cleaning up explicitly can help avoid lingering issues.