
-----------------------------------
born130
Fri Jun 06, 2003 4:00 pm

How do I make a High Score table?
-----------------------------------
Hello,

I wanted to know how I could make a high score table in my game.

For example if the user breaks the record say 9.68 seconds, it will "save" this number as the new record to beat. Just like an arcade game.

Some people say i should use a text file?

Any help is appreciated.
thanks

-----------------------------------
hello
Fri Jun 06, 2003 4:13 pm


-----------------------------------
u should use a textfile to store the scores or times

then when u get a new time or score

check if the tenth score or time in the textfile is smaller or greater then the inputed one

and if its watever (greater or smaller)

then replace the tenth score with the inputted score

and then
start check in a decreasing loop
if the ninth score is watever to the inputed one that is tenth
and if watever switch them

-----------------------------------
born130
Fri Jun 06, 2003 4:15 pm


-----------------------------------
show example

-----------------------------------
Tony
Fri Jun 06, 2003 7:06 pm


-----------------------------------
open : fileName, fileNum : get
get fileNum, tempValue

if scrore > tempValue then
open : fileName, fileNum2 : put
put fileNum, score
end if

/\ something like that... I'm not sure of the syntax though, didnt use that in a long time

-----------------------------------
JSBN
Fri Jun 06, 2003 7:50 pm


-----------------------------------

var filenum,score,highscore : int
open: filenum,"Highscores.txt" get
get: filenum, highscore
close : filenum

if score > highscore then
open: filenum,"Highscores.txt" put
put: filenum, score
close : filenum
end if

That should be what you are looking for.

-----------------------------------
naoki
Fri Jun 06, 2003 7:56 pm


-----------------------------------
make 2 arrays : 1 to hold the name, 1 to hold the score
loop and read all the names and scores from a textfile, storing them into the array

afterwards loop again and see if the new score beats any of'em. if it does then delete last score and name and move every entry down 1, putting new score in its appropriate place

then loop again and write it all into the textfile.

-----------------------------------
Andy
Fri Jun 06, 2003 9:23 pm


-----------------------------------
born130, you know you can just call me and ask me or ask me at school eh? instead of having hang helping you... jk
