Need some advice here. I have a puzzle game that currently consists of 50 levels. I am using local storage to store the highscores and so on. So on the home screen I have events that check for every level's highscores and if they exists, get and restore them so that they will be available when player selects the levels.
I am currently adding about 5 - 8 new levels per week and I can see that in a few month's time this can really add up. Will it be an issue when I have to check for say 150 - 200 highscores from local storage on the main screen? I mean .. apart from the few hundred extra events ..
Couldn't you use one dictionary object to have all highscores?
Then you'd only need one localstorage storage..
I'm using an Array for World of Mineshaft. It stores how many stars they earned for the level, and the amount of gold. That way if they replay a level it uses the time they had the most gold. Every time the Array is changed it's saved to local storage. And before any time it's used, it's read back.
If arrays are confusing to you think of the X,Y,Z as coordinates, or a weird name. Even when you are using just X, it's actually x,0,0 you are using. Think of 1,0,0 as the name of the first slot.
Can you show a brief example of events to do that? I am using arrays to do other things like generate sprites but never used it to store scores.
So say I have 50 levels, do I need 50 global variables and create a 5 x 10 array to store each slot per level or do I only need 1 variable and save the score for that level to a different slot?
Develop games in your browser. Powerful, performant & highly capable.
My array is X,0,0 where X is the level, holding the scores for each level.
in X,1,0 is the number of stars, which I set the sprites to that frame of animation, which shows the stars.
(oh yeah, you probably already know, but since it takes time to load, Event 2 is a trigger that fires when the load is complete.)
Thanks! Works perfectly.