Hi all. I am trying to link the real-time score variable count to all scenes/nodes but putting the variable in the global script alone doesn't seem to work.
In the global script:
var score = 0
In the menu/score-keeping/leaderboard script (this works fine):
func _on_Player_scored():
global.score += 1
In main scene script: Spawn mobs when the player is still below or above a certain score. This does not work as the global.score on the main script stays 0 even when the player is scoring.
Vice versa. I tried the opposite way; connect the player_scored signal to the main script and its mob-spawning function works but the score count label on the menu script stays 0 instead.
The only way I can get the score to count on both sides is to connect the Player_scored signal on both scripts but I'm sure there's a better way to do this.
Appreciate it if anyone could advise. Thanks!