Page 1 of 1

High Score list!

PostPosted: Sun Sep 19, 2010 10:40 am
by lcl
So, here's my high score list engine!
You can freely use it in your game. :D

The list automatically drops
lower scores, if you get better one. :D

Example gives you some random score, and then you can type your name in, and
it adds your score and name to list. :D

Enjoy! And tell me if something could be done better. :D

Re: High Score list!

PostPosted: Sun Sep 19, 2010 6:03 pm
by zxcvbnm
This is great work Lcl , a bonus feature to add to any game. Alot of vets and newbies will thank you for your hard work .

Re: High Score list!

PostPosted: Mon Sep 20, 2010 4:18 am
by Bee-Ant
Nice, but pretty looong code for such thing...
You can use Bubble Sort to do this kind of stuff...
Code: Select all
#define arraysize 10 //arraysize is your max array number to store the Score
int array[arraysize];
void Sort()
{
   int i,j;
   for(i=0;i<999;i++) //999 is the loop number for value checking, no need to change this
   {
      for(j=0;j<arraysize-1;j++) //since we use [j+1] bellow, so we use arraysize-1 here to prevent "out of bound" checking
      {
         int temp; //just for temporary
         if(array[j+1]>array[j]) //if there's any value greater bellow the current index, switch it
         {
            temp=array[j];
            array[j]=array[j+1];
            array[j+1]=temp;
         }
      }
   }
}

You can use this function to sort Score, Item, anything :D

Re: High Score list!

PostPosted: Mon Sep 20, 2010 5:41 am
by lcl
Wow, Bee-Ant... :D I knew that there must be shorter way to do it...
You are genius with the code. :D

Re: High Score list!

PostPosted: Sat Jan 28, 2012 1:21 pm
by ayu04
Thankyou sir, :)))

Re: High Score list!

PostPosted: Sat Jan 28, 2012 2:17 pm
by SuperSonic
Looks cool :D