I'm getting towards a point where I can publish my game to iOS and Android, but I'm having an issue with localstorage which is making me scratch my head a bit.
The game functions correctly, and I'm using localstorage to save the hi score and the audio on/off toggle, and now I'm adding in achievements to add a bit of longevity. To drive a few of the achievements, I have to store the total number of enemies killed - so each time an enemy is destroyed, I add 1 to the global variable TotalEnemiesDestroyed. So far, so good. On player destroyed, I'm then setting the localstorage item totalEnemiesDestroyed to the value of the variable TotalEnemiesDestroyed.
This is working whilst in the game, but if you exit and come back in, the value is wrong, like it's not saving properly or not loading properly on my Start layout.
So... My question is, are there any limitations with localstorage that I need to know about? Should I try loading everything in my splash screen instead and not progress until it's all loaded? Is there a better way of storing all the data I need to save rather than having separate localstorage items?
Sorry if I've not explained this very well! Any help or comments would be very much appreciated. I want to finish Swarm so that I can start on some new games thank you in advance!