How to make sprite's visibility change to true after a different sprite with different script was turn to invisible?

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

I have created a scene with few panels and put sprites to them as their child nodes:

I have also created an Area2D (called paperArea2D) and wrote a code so then when one of these panels enters this area, their sprite’s visibility changes to false:

However now, I am trying to write a code which would work like this:
–>When a specific sprite of one panel (e.g. dragTriangle) changes its visibility to false, another sprite that is not a child of this panel - and its visibility is put on false by default - (in this case sprite called trianglePaper : should change its visibility to true.

I tried to do this by puting both of these sprites and panel to one group called draw and (in the script of the panel) call a function that is written in the script of trianglePaper sprite (the sprite that is supposed to become visible):

However, this makes the trianglePaper sprite siwtch to visible immediately after running the game.
I wish I could write something like this to make things clear and simple, but that won’t work:

Is there any way to make this code work the way I anticipated?

:bust_in_silhouette: Reply From: ponponyaya

Since you already have a group, mayby you can try pass an parameter in function call_group() like this:

get_tree().call_group("draw", "trianglePaper", visible)

And in another Script:

func trianglePaper(dragTriangleVisibel: bool):
	if dragTriangleVisibel == false:
		# do What you want to do!

Oh my god it worked!
Thank You soooo much.
I have a lot of trouble with basic things but your help really makes me feel like I will actually finish the project.
Thanks for showing me the way with puting one more info in the “call_group” brackets and adding the boolean expression on the function.

Alena | 2022-02-12 13:35