How to prevent nodes to act in the scene if inactive

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Rodrigo Alves
:warning: Old Version Published before Godot 3 was released.

I got this player character that has some spells available in its tree:

And it should activate whenever the player hit the mouse button. My script does show()/hide() for activating and deactivating the spells:

Although even if it’s not activem my spells are still colliding with enemies and dealing damage. It seems show()/hide() isn’t suitable for this case. What would be the best practices for nodes that shouldn’t be acting in the scene when inactive?

:bust_in_silhouette: Reply From: eons

“hide” is just a visual (CanvasItem) thing, you need to add a check on the damage or disable layers/masks, etc. on top of hiding it (depending on what are you using and how things move).