Highscore Table
Blitz3D Forums/Blitz3D Programming/Highscore Table
| ||
Would anyone be able to tell me how to do this? |
| ||
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:) |
| ||
try this: 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... |