Where is the code where you’re setting global.score to a new value? I only see where you’re getting the variable. The setter will only be called when you set the variable.
I start it at 150, however it does not change the value in the Label during the game.
PerduGames | 2017-07-14 20:48
TIP: If it works better for you, you can have your scoreChanged signal pass the score along with it. Then your label can set its text without having to look outside its own scope.
extends Node
signal scoreChanged( to )
func setScore( _score ):
score = _score
emit_signal( "scoreChanged", score )
And on the receiving end:
extends Label
func _ready():
global.connect("scoreChanged", self, "_on_scoreChanged")
global.score = global.score #kickstart the setter
func _on_scoreChanged( to ):
set_text( str( to ) )
YeOldeDM | 2017-07-14 20:53
I realized that it is “global.score = global.score” that makes it work in both ways, why do I have to assign it? If it already starts at 150?