Would anyone be able to tell me how to do this?
Highscore Table
Blitz3D Forums/Blitz3D Programming/Highscore Table be more explicit please:)
which parts of the code are you having trouble with, what have you got, post any code you are having problems with.
If you are looking for everything, check code archives, and do searches for previous posts.
but in a 'nutshell':
after end of game
compare score of game just gone with
all the high scores (maybe store them in an array, or a type.
If the current score is greater than one of the highscores, then delete the lowest high score, move the lower highscores down one position. Store the current score in the slot left over - ie the one above it is higher, the one below it is lower.
Use sprites or quads to display or normal text, depends how fancy you want it:)
Hope this helps:)
which parts of the code are you having trouble with, what have you got, post any code you are having problems with.
If you are looking for everything, check code archives, and do searches for previous posts.
but in a 'nutshell':
after end of game
compare score of game just gone with
all the high scores (maybe store them in an array, or a type.
If the current score is greater than one of the highscores, then delete the lowest high score, move the lower highscores down one position. Store the current score in the slot left over - ie the one above it is higher, the one below it is lower.
Use sprites or quads to display or normal text, depends how fancy you want it:)
Hope this helps:)
try this:
adjusted code as i wasnt paying attention.
adjusted code as i wasnt paying attention.
Graphics 800, 600, 16, 2 SetBuffer(BackBuffer()) : ClsColor 0, 0, 0 : Cls : Flip Dim high_score(10) For a = 1 To 10 high_score(a) = (11 - a) * 1000 ; populate array For example purposes Next current_score = 4900 ; again for example purposes Text 50, 30, "H I G H S C O R E S" For a = 1 To 10 Text 50, 50 + (a * 15), Str high_score(a) Next Text 50, 50 + ((a + 2) * 15), "Press a key to continue" Flip WaitKey ; at end of game For a = 10 To 1 Step -1 If current_score > high_score(a) ;Select a ; you could use select/case if you wanted high_score(a) = high_score(a-1) : high_score(a-1) = current_score EndIf Next Text 50, 285, "H I G H S C O R E S" For a = 1 To 10 Text 50, 300 + (a * 15), Str high_score(a) Next Text 50, 300 + ((a + 2) * 15), "Press a key to End" Flip WaitKey
From the dusty archives...
Const MAX_HISCORES = 10 Dim hi_scores(MAX_HISCORES) Graphics 400, 300, 0, 2 SeedRnd MilliSecs() Repeat Cls For s=1 To MAX_HISCORES Text 10, s * 12, "No" + RSet$("0" + s, 2) + " - " + RSet$("000" + hi_scores(s - 1), 4) Next Text 10, 160, "Any key to add new score" Text 10, 200, "Last entry " + RSet$("000" + r, 4) If in Text 140, 200, "was a hiscore (No:" + in + ")" Else Text 140, 200, "wasn't a hiscore" EndIf WaitKey() r = Rand(1000) in = insert_hi_score(r) Flip Until KeyHit(1) End Function insert_hi_score(score) Local s, t, p = MAX_HISCORES hi_scores(MAX_HISCORES) = score For s=0 To MAX_HISCORES - 1 If hi_scores(MAX_HISCORES) > hi_scores(s) t = hi_scores(s) hi_scores(s) = hi_scores(MAX_HISCORES) hi_scores(MAX_HISCORES) = t If s < p Then p = s EndIf Next If p < MAX_HISCORES Then Return (p + 1) End Function