How to control multiple instanced scenes together

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

Hi! Correct me if I’m wrong, but when you use instance and add child on a scene you add it as a child of your node, and the first child retains its name and can be referenced normally, but subsequent ones are numbered, ie their names change.

What I wanna know is what’s the best way to invariably control all these different instanced child copies of the same scene at once. For example if I have a player character that could shoot multiple bullets at a time, but with a button press I want all the bullets to perform a function from their code, what are the ways to do that?

Thanks in advance <3

:bust_in_silhouette: Reply From: exuin

You should put all of the bullets into a group and then call get_tree().get_nodes_in_group() to get all your bullets. Then iterate through the resulting array and can whatever method you need on them.