This finds a node in your GUI scene with the ID “heart0” and returns it as a NodeProxy:
gui.get_node("heart0")
We then pass that to gui.set_enabled()
, which takes a NodeProxy and a boolean as its arguments:
gui.set_enabled(gui.get_node("heart0"), false)
Giving it false
will disable the node, and giving it true
will enable the node.
You can also store the NodeProxy as a variable, which is helpful if you need to perform multiple operations on a node (like moving it, changing the color, playing an animation, etc.) or just to make the code clearer:
local my_node = gui.get_node("heart0")
gui.set_enabled(my_node, false)