Upgrade menu for a Tower Defence game

I think I’ve figured it out.

You’re adding your towers to the Tree $Towers. This makes every tower a child of $Towers as its own sub-tree.

Then, when you get_tree().call_group(“CannonTower”, “upgrade_damage”), you are calling every member of group “CannonTower” in the tree the signal came from. Since every tower is in its “own” tree, it only calls “upgrade_damage” for itself.

I believe if the signal were to come from $Towers instead, it would upgrade every tower “below” it (every child that is of group CannonTower) in the tree structure.

1 Like