Attention | Topic was automatically imported from the old Question2Answer platform. | |
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?