Topic was automatically imported from the old Question2Answer platform.
Asked By
Zuckey
I have a main game scene inside I have my player scene and my Enemy scene, when I duplicate my enemy scene with Ctrl+D the duplicated one doesn’t work as it should but the original one is working properly.
doesn’t work as it should
Is not actually a problem description.
sash-rc | 2020-11-15 17:01
It doesn’t recieve signals as it should. Sorry for not being clear, I was just so frustrated.
duplicated scenes will share the same exact script as the original one which can create some problems. Perhaps this is the issue? Maybe try deleting the script on the duplicate and making a new one?
Signals in editor are attached to concrete nodes. Move signal handler to higher Node in tree hierarchy instead. And call your Enemy’s method (for each enemy) from there.
You can use group feature for this purpose.
get_tree().call_group("enemies", "enemy_method")
or simply iterate children and call enemy.enemy_method()
Couldn’t understand the part do something with all its children, how do I do that?