Recently I made a game with "easy", "normal", "hard" modes. You can choose any mode on the menu.lua page(which is first scene loading in main.lua). When you end the game for example in "easy" mode, this happens:
1) in
game.lua "onExitBegin" listener
easyVal = math.max(easyVal, times)
DataSaver:saveValue("easy", easyVal) |
Note: easyVal is global value declared in menu.lua via
easyVal = dataSave:loadValue("easy") |
2) then go the the menu page in
menu.lua easyVal is declared in Menu:init() and again here it is printed
Thus highscore was updated, the score doesn't change after exiting game.lua and updating easyVal. Can you please point me to a solution?
Comments
- the data save class (I put it in its own file, those are declared as global)
See also https://wiki.gideros.rocks/index.php/Start_Here#Save.2Fread_data_persistently
Likes: definisto
Likes: MoKaLux