|Topic was automatically imported from the old Question2Answer platform.
Sorry if this is a bad question, but I can’t figure it out.
I tried google ing it, but maybe my terminology was wrong, as I couldn’t find any answers.
My problem is that one of the labels of a small test game I have created won’t update on the HTML build version.
This is especially weird since I tried all methods of changing the label’s value, and the label’s script currently looks like this:
text = 'Highscore: ' + str(Globals.highscore)
I know that’s maybe not the standard version of updating a label, but I can’t figure out what the problem is, since it works just fine in the version of the game that I run in the engine, but when I go to export it, the HTML version won’t update the highscore label.
For more information that might be related to my issue, the highscore is updated every time the score exceeds its value, and is saved in the Globals.gd script, which is a singleton (I also use it to display the score, which works just fine in the build). This is the script snippet I use to update the highscore:
Globals.score += 1
if Globals.score > Globals.highscore:
Globals.highscore = Globals.score
Thank you in advance for any help that you might want to offer, and sorry for the long post, I just wanted to explain my problem as well as possible. Have a great day!
Why do it on the
_process function instead of emitting a signal each time the score value changes?
Lazarwolfe | 2021-02-09 07:03
You can post it as an answer, because using signals seems to fix the issue.
I did this because I wanted to complete a project from start to finish, this being my first one mainly to see how the exporting process is in godot. I was basically too lazy to learn how to create a signal for a variable change, but this morning I did that and it worked.
Still don’t know what the original issue was caused by, but using signlas seems to work perfectly.
Thanks a lot!
(You can post this as an answer and I’ll give you best answer if it helps you)
Cosmeen | 2021-02-09 07:59
It’s all good, Internet points are worthless anyways, glad to hear it worked!
Signals are a great bit of functionality that I don’t know if I’m gonna be able to work with if I ever migrate from Godot.
Lazarwolfe | 2021-02-09 16:28