Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Kaendan | |
Old Version | Published before Godot 3 was released. |
Hello guys!
My friend and I are trying to create a top-down adventure game.
In our game, when we kill a monster, it drops some particles and a sound is played. Here is our problem: How can we destroy our monster and not destroy its particle and soundplayer node?
We found two solutions but we are not sure which one we should use and if they are really good :
-
At the beginning I simply created a deathtimer:
When a monster die, I queue_free() its sprite, its CollisionBox and everything that could create any bug. Then I start the timer, play the sound and drop the particles. At the end of the timer, I queue_free() the entire scene.
The problem with that solution is that, appart from particles and the soundplayer, I have to queue_free() everything inside my monster scene to avoid any bug (remaining collisions for example). I don’t really thing this timer trick is a good solution. -
Then I thought that a better solution would have been to reparent the particle node and the soundplayer so that they can still live in the world scene without the monster. With this solution I can queue_free() my monster without any problem. BUT! Particles in the world scene are never destroyed! What should I do? Create a “temporary_object” script to destroy particles and soundplayer on_finished?
With that solution, I don’t have to worry about using queue_free() on a lot of nodes inside my monster scene. But I still have to reparent what I want to keep and maybe create some temporary objects. So is that finally a better solution ? I’m not sure about it…
How would you do that?
I really hope this post is understandable.
Please ask questions if you want some clarification!
Thank you for you reading and/or your help!