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

Hello,
I have created a scene with few panels and put sprites to them as their child nodes:
https://drive.google.com/file/d/1elgQ6wspdnJWtg69JoS7H8vl4DjmCN8W/view?usp=sharing

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:
https://drive.google.com/file/d/1Wn7sdDuiNn97bizc_spoBAEBdQJZbgfE/view?usp=sharing

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 : https://drive.google.com/file/d/1JE3OGwdDgTLS1VCKoumvfyHoemWpUaya/view?usp=sharing) 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):
https://drive.google.com/file/d/1bUvDLCjZsp1LQe8kWjqitdbEkZTioIjY/view?usp=sharing

https://drive.google.com/file/d/12gfTlpYHUxFAzMbDj7q9nta3Z7JG2Qvm/view?usp=sharing

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:
https://drive.google.com/file/d/1bA1VuRtKGmHNW4bEJUYUQ9XcXjOYyR4k/view?usp=sharing

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!
		print("blabla...")

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