How to get rid of the bullets completely when changed to another scene?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Crispian-Troyo369

Some enemy bullet scene instances residues are appearing when I transitioned to a completely new scene in its camera view. Is there something I have to change on my code when screen transitioning? I’m at a lost of any solution here. A few more other bullets that were instantiated before the screen transitioned to another, was showing itself like this on my game’s end screen.

:bust_in_silhouette: Reply From: stormreaver

If you add the bullets to the scene being replaced, then they will be automatically removed when the scene is freed.

I get it now. Turns out all the bullet residues are getting appended to the root scene and it delayed until they get part of the other screen. I totally fixed it. Thanks

Crispian-Troyo369 | 2022-10-30 16:58

Another technique I use is to add bullets to the main scene, but have the bullets themselves timeout (and handle collisions) and queue_free() themselves. That way they don’t all abruptly disappear when a child scene is switched to something else. It looks more natural.

stormreaver | 2022-10-30 17:30