I just tried implementing localstorage into my game, and I found an issue that I would like to hear anyone's opinion on.
I am using an array to store which levels have been cleared, and which is still locked because the previous levels haven't been cleared. The problem I am having is that previously, I would load the array and set each button's animation frame to display the appropriate frame as a sub event to the on start of layout event. This ensured that everything was set up immediately at the start, and the player will not notice it.
But since LocalStorage can only be used as an event and not sub event, I placed the button animation frame loading events as a sub event for the On item get event, since I thought it made the most sense to put it there and have it load immediately once the value has been retrieved, and also to ensure it only loads once. But the problem is that loading the LocalStorage takes a small but noticeable amount of time. When loading the page, you will notice the button frames changing from default animation frame to the loaded one.
I was curious what others are doing to counter this loading time to ensure that it isn't noticeable for the player? Is the only option to use an earlier page to load all the values than when you go to the next page, do not reset all global variables but use the earlier loaded variables so you can add it as a sub event to the on start of layout event? Or is there another way to get it to load much faster?
Hello rekjl
I'm facing the same problem. I excluded all my LocalStorage function in an extra event sheet called 'es_LocalStorage' and included the event sheet in all event sheets where I need the loading function. When my levelselection screen comes up the player first sees all levels as locked, then when the LocalStorage has been loaded from the LocalStorage the LevelsButton Animation changes to unlocked.
It's just a little time frame but it is noticable.
It helps if you use a menu and a levelselection as separate layouts. Then you can fetch the array at the menu, so the values are already available in the levelselection screen. Otherwise I have no idea at the moment to work around this issue.
Regards Andreas