Hi-scores

Talk about making games.

Hi-scores

Postby Joshua Worth » Mon Jul 17, 2006 1:04 pm

Could someone please completely fix(or redo) this code for a top 3 hiscores list:
Code: Select all
if (leveltime < hiscore1[levelnum] || hiscore1[levelnum]==0) hiscoretest=3;
if (leveltime < hiscore2[levelnum] || hiscore2[levelnum]==0) hiscoretest=2;
if (leveltime < hiscore3[levelnum] || hiscore3[levelnum]==0) hiscoretest=1;

            switch (hiscoretest) {
                case 1 :
                    hiscore3[levelnum]=hiscore2[levelnum];
                    hiscore2[levelnum]=hiscore1[levelnum];
                    hiscore1[levelnum]=leveltime;
                    break;
                case 2 :
                    hiscore3[levelnum]=hiscore2[levelnum];
                    hiscore2[levelnum]=leveltime;
                    break;
                case 3 :
                    hiscore3[levelnum]=leveltime;
                    break;
                             }

you will notice that "hiscore1,2&3" are "real"(to get decimal places) arrays, representing 1st 2nd and 3rd places for evry level. "leveltime" is a real variable telling you the time you took. on the level you just did. It is meant to push down the numbers below it to make way for the number it is about to put there. At the moment, the hi-scores go a little bit crazy. I think it has somthing to do with the number having a decimal place or not...

I hope this will be fixed easily!...
Stay sweet
User avatar
Joshua Worth
 
Posts: 515
Joined: Tue Jul 19, 2005 12:00 am
Location: Stralia
Score: 5 Give a positive score

Postby makslane » Tue Jul 18, 2006 1:36 am

I didn't understand the variable leveltime.
Can you explain better?
makslane
Site Admin
 
Posts: 3947
Joined: Sat Apr 05, 2003 6:47 pm
Score: 182 Give a positive score


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron