Best way to keep multiple level scores?

Get help using Construct 2

Post » Thu Sep 17, 2015 10:02 am

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 ..
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Thu Sep 17, 2015 2:19 pm

Couldn't you use one dictionary object to have all highscores?
Then you'd only need one localstorage storage..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Thu Sep 17, 2015 2:37 pm

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.
B
226
S
60
G
33
Posts: 902
Reputation: 39,955

Post » Thu Sep 17, 2015 11:13 pm

@Paradox

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?
B
23
S
10
G
2
Posts: 104
Reputation: 3,071

Post » Fri Sep 18, 2015 5:53 am

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.

Image

(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.)
B
226
S
60
G
33
Posts: 902
Reputation: 39,955

Post » Fri Sep 18, 2015 7:23 am

@Paradox

Thanks! Works perfectly.
B
23
S
10
G
2
Posts: 104
Reputation: 3,071


Return to How do I....?

Who is online

Users browsing this forum: ksiads and 1 guest