Godot Version
v4.2.2.stable.official [15073afe3]
Question
New to godot and trying to figure out components/signals,
I have many enemies that are all copies of the same scene, what’s the right way to only damage the correct one? I have a reference to the target enemy object (from a dynamic raycast result.collider.owner) that may or may not have a ‘health’ component child, depending if it’s an enemy or a wall. I’m trying to figure out how to only signal the one enemy/wall hit, instead of all enemies.
A lot of what I’ve found is saying to use get_node and call my takeDamage function directly, but it looks like that’s outdated/bad practise to use hardcoded strings?
Is there a ‘correct’ way to check if a node has a specific child component? I’m unsure if a signal vs calling directly is the right way to approach this.