I tried to implement a highscore and score into a tinyDB such it gets imported to the second screen, however, the score and highscore values do not return properly (shows 0 for both)
First picture shows blocks for screen1, and second picture shows blocks for screen2 (directs to screen 2 after game ends)
See those little
marks on your blocks ? You can not initialize a global variable to call data. Initialize to an empty string and set them to call data on Screen initialize
It seems to work now, however, my highscore is being reset. Everytime I get to screen 2.
You don't really need global variables, if you work directly from TinyDB:
Screen1
Screen2
Notice that I do not try to open Screen1 from Screen2.
You have to close screens as often as you open them, to avoid filling memory.
Also notice that you have to refresh the screen from TinyDB on your return.
Is there a code for the Tiny DB for pong
Yes, in the post above yours.
you cannot initialize a variable to a tinydb (and or storage component). In order to workaround this, initlizalize it to something like a “ “ block or anything, and then when screen.initialize, do what you did before, but with a set variable to block
have it save on the other screen too




