So, i have two questions:
But before, i need to say, im a beginner programmer, with only 1-2 years of experience
1. How i can get a node from the tree?
The tree is:
Game
-button1
-button2
-player
--playerSprite
I want to get the node 'button1' (it is a textureFrame bcs it isnt exactly a button) from the player script, so when the player spawns first, the button is not visible
I tried: gettree().getroot().getnode('Game').getnode('button1').setvisible(false)
But i get this error: "Attempt to call function 'getroot' in base 'null instance' on a null instance."
AND How i can check collision between an area2D and the player inside the player's script?
For example, i want to set the score to 1 when the player enters the area2D. But i want to do that in code
EDIT: I noticed Godot's "for" loop is using the syntax "for ... in ..."
I learned just the simple "for" loop
example: for (i = 0; i < x; i++)
What does "for... in..." loop?