Page 1 of 1

Score Archive

PostPosted: Mon Jul 18, 2011 6:18 am
by raminjoon
How can I make a table which saves all scores my players are getting of all levels in my game?

okay lets say my game has 10 GED files which each are a level what I want to do is to have a archive file which loads if player wants to see the scores history and so on. but my main problem is how to make it to the point where I have this archive file and it saves all scores and releases new levels based on player achievements. if your not understanding me plz reply so I can explain myself.

Re: Score Archive

PostPosted: Mon May 21, 2012 2:10 am
by Bee-Ant
The most basic way:
Make a global variable called "SCORE", integer, Array: yes, size: 10 (depend on your levels count), save group: data.
When you're in level 1 and want to load level 2:
Code: Select all
SCORE[0]=your_score;
saveVars("score.sav", "data");

When you're in level 2 and want to load level 3:
Code: Select all
SCORE[1]=your_score;
saveVars("score.sav", "data");

etc...

To show the score list, use this code on text actor:
Code: Select all
int i;
char str[24], txt[256];
loadVars("score.sav", "data");
strcpy(text,"");
for(i=0;i<10;i++)
{
    sprintf(str, "Level %i: %i\n", i+1, SCORE[i]);
    strcat(txt, str);
    strcpy(text, txt);
}