Page 1 of 1

Hi-scores

PostPosted: Mon Jul 17, 2006 1:04 pm
by Joshua Worth
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!...

PostPosted: Tue Jul 18, 2006 1:36 am
by makslane
I didn't understand the variable leveltime.
Can you explain better?