Changing a Child's Variable when it was Spawned In-Game

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

In short, I am using add_child() to add a child node when a timer goes off. When it is clicked on, I want one of its variables to change. There are going to be multiple of this node, and I don’t want to change that variable in all of them. How could I go about doing this?

Check out this tutorial.

skrx | 2018-11-07 09:24

Actually, I should have been more specific - I want the child’s variable (health) to subtract the parent’s variable (damage) but the child node is spawned after the game starts

ThreeSpark | 2018-11-07 14:36

:bust_in_silhouette: Reply From: Zylann

Do you mean like this?

child.health -= child.get_parent().damage
:bust_in_silhouette: Reply From: Christoffer

you can do something like this, i’m not sure how effective it is but it’s working .
and then you can have a variable in each one that says clicked ?