I've just discovered groups and understand basically how they work, but I'm wondering if there's a better way to call an identical function for several members of a group. Let's say that I have 10 types of alien in my scene and they're all in a group. When I hit the spacebar, I want them all to respond in the same way. As far as I can tell, the way to do this is something like
get_tree().call_group("aliens", "spacebar")
And then in EACH of the alien scripts, have a 'spacebar' function that does whatever. This is fine if they all reacted differently, but if the function is the same in each script, that seems like a lot of extra work.
I'm wondering if there's a way to have a sort of 'Group script'? Or would I just do this completely different, e.g when the spacebar is hit, cycle through the members in the script that detects the input and do the processing there?