Can not access score variable of the parent "game_information" from the child "ball". (I am newbie)
get_parent doesn't work
- Edited
- Best Answerset by Xtreme_93
There are two problems:
- "score" is declared inside a function, so it's not accessible outside that function.
- A parent is not "ready" until after all its children are "ready".
I recommend:
- Move "var score" before the _ready() function in game_information.gd.
- Move "var game_information" before the _ready() function in ball.gd, but don't initialize it there.
- Add to _ready() function in game_information.gd: $ball.game_information = self
DaveTheCoder
It works ! Thank you! I started godot newly and I love it !