2
\$\begingroup\$

I have multiple objects, each has area2d and collision shape, I click it, I hide it.

Now, I create script and attach it to the main Node2d with the following

extends Node2D


func _ready():
    if (get_node("matchbox_closed").hide() && get_node("oil").hide()):
            get_node("match").show()

it hides the first object in the list automatically, what I want is to check not to hide, but I can't see any boolean that check that or any isvisible getter like Libgdx

\$\endgroup\$

2 Answers 2

6
\$\begingroup\$

From a Godot QA post there should be a method is_visible(). Try get_node("node").is_visible(). Looking at the docs this method seems to apply to CanvasItem, though so perhaps you have to use CanvasItems if you want to check visibility.

\$\endgroup\$
1
\$\begingroup\$

The documentation shows that both CanvasItem and Spatial have a visible property.

Note that CanvasItem is a parent class to both Control (used for GUI) and Node2d (used for 2d). When considered with Spatial (used for 3d) this means visible is available for most nodes that can be drawn.

\$\endgroup\$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .