First of all, excuse my English, I'm using the translator.
I am creating a quiz game, where the answer is typed by the player, but I have a problem loading the score when re-entering the game.
While playing it saves the score, but when the player leaves and enters the game it starts from 0 again. The levels are enabled when the player has a certain number of correct answers and it is also reset to 0.
It's my first time making a game and I don't know what I'm doing wrong, I'm following tutorials but there are none like the game I want to make.
You need to show the relevant blocks, probably one by one, that save the players level and score, and how these are supposed to be retrieved when the app is restarted (presumably by entering the player's name ?)
It's possible to avoid the pain of having to synchronize your global variables and their TinyDB copies at app startup and save time.
The secret here is to totally eliminate global variables, replacing them with getter/setter procedures that dynamically access TinyDB or component lists behind the scenes.
Before replacing global variables with procedures: