Can not access score variable of the parent "game_information" from the child "ball". (I am newbie)

  • There are two problems:

    1. "score" is declared inside a function, so it's not accessible outside that function.
    2. A parent is not "ready" until after all its children are "ready".

    I recommend:

    1. Move "var score" before the _ready() function in game_information.gd.
    2. Move "var game_information" before the _ready() function in ball.gd, but don't initialize it there.
    3. Add to _ready() function in game_information.gd: $ball.game_information = self

There are two problems:

  1. "score" is declared inside a function, so it's not accessible outside that function.
  2. A parent is not "ready" until after all its children are "ready".

I recommend:

  1. Move "var score" before the _ready() function in game_information.gd.
  2. Move "var game_information" before the _ready() function in ball.gd, but don't initialize it there.
  3. Add to _ready() function in game_information.gd: $ball.game_information = self