[Discussion] Basics: Node Communication (the right way)
Comments for http://godotrecipes.com/basics/node_communication/
So if I only want 1 enemy to die with the Galaga example, and they are part of a group just because, how do I handle that? At the moment I have a project where my enemy units (KB2D) are in the group. Once an enemy is killed then all are killed because I'm calling the group from the player node so that the player can find it.
@brobruno51 it depends, what exactly are you wanting to do? Is it that all enemies except that 1 should be immune to the attack? Or the attack is targeting the 1 specific enemy? Or what?
Hi. Yes the attack is just targeting 1 specific enemy. I did figure it out in the end. I was calling all enemies in a group. I can't remember what I did to fix it, but basically I managed to isolate it. Thanks for the reply.
Hi! I've been having a similar problem to @brobruno51 , where there is a drag-and-drop item instanced in code. It has a signal so that when a body enters it, it prints a message to the console, but it doesn't fire when it is entered by a StaticBody2D. I didn't know if this was a communication problem or something else, but with the amount of code-checking I've done, I've wondered if it was a communication problem, or a problem with it being an instanced scene. Just thought I'd ask. Thanks in advance!
When you say "entered by a StaticBody2D", are you moving the static body?
No, I was moving an Area2D into a StaticBody2D. Somehow, restarting the project (remaking all the nodes in new scenes in a different Godot project seemed to do the trick. They're not all the same as they were in the first project, so I'm not sure if it was a glitch, or I did something and didn't realize I was messing everything up. Thanks for replying!
(note I'm new to Godot/GDscript).
I was trying the "Signal example" in a dummy project and found that it wasn't working.
In Object of type 'Node': Attempt to connect nonexistent signal
I found out by doing another tutorial that I had to define signal in the Node where I'm emitting my signal from. Perhaps it could help others to include that information in the document?