Score Archive

Talk about making games.

Score Archive

Postby raminjoon » Mon Jul 18, 2011 6:18 am

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.
raminjoon
 
Posts: 40
Joined: Tue Jul 05, 2011 5:34 am
Location: Denver, Co.
Score: 3 Give a positive score

Re: Score Archive

Postby Bee-Ant » Mon May 21, 2012 2:10 am

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);
}
User avatar
Bee-Ant
 
Posts: 3723
Joined: Wed Apr 11, 2007 12:05 pm
Location: http://www.instagram.com/bee_ant
Score: 210 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest