Yesterday, 03:48 PM
Hi
HOF.zxbas - Hall of fame procedures
main.zxbas - a demo
Attached is a little "library" for a Hall of Fame / High Score table.
To use it - you need to create two Arrays (at least 2 ...)
Array 1 = UInteger, for scores
Array 2 = String, for names
Probably best to keep to 10 entries, but could be more. You can have more than 1 HOF, so could have Array2, Arry3 etc etc for say Easy Score, Medium Scores, Hard Scores. As it passes the Arrays by reference, no other variables are needed.
Completely and utterly free to use, adapt, change, republish how ever you want.
Arraybase is 0
SUB HOF_IntialiseHOF(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, HOF_IntialTopScore as UINTEGER,HOF_InitialName AS STRING)
Use this to initialise the two HOF arrays - with a "highest score, working down to a low score and gives each entry "InitialName".
FUNCTION HOF_HighScore_CheckEntry (HOF_Scores() AS UINTEGER, NewHighScore as UINTEGER) AS BYTE
Returns 1 if the High Score can g into the Arrays.
SUB HOF_HighScore_NewEntry (BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, NewHighScore as UINTEGER, NewHighScoreName AS STRING)
Puts the new entries (name & score) into the HOF array.
SUB HOF_Print(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, YPOS as INTEGER, XPOS as INTEGER)
A simple print location, witch prints the Score and Names. Will carry on printing if you have many entries ...
SUB HOF_PrintSpecial(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING)
A "pretty High Score screen", that prints the top 10 scores.
Can probably be improved and made much more efficient. There are porbably bugs as well (for example not sure what would happen if you had 100 entries with a first high score of 10 ... i think it's probably overflow to 655555 etc. It includes string.bas and input.bas - not sure if the library needs both of those.
HOF.zxbas - Hall of fame procedures
main.zxbas - a demo
Attached is a little "library" for a Hall of Fame / High Score table.
To use it - you need to create two Arrays (at least 2 ...)
Array 1 = UInteger, for scores
Array 2 = String, for names
Probably best to keep to 10 entries, but could be more. You can have more than 1 HOF, so could have Array2, Arry3 etc etc for say Easy Score, Medium Scores, Hard Scores. As it passes the Arrays by reference, no other variables are needed.
Completely and utterly free to use, adapt, change, republish how ever you want.
Arraybase is 0
SUB HOF_IntialiseHOF(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, HOF_IntialTopScore as UINTEGER,HOF_InitialName AS STRING)
Use this to initialise the two HOF arrays - with a "highest score, working down to a low score and gives each entry "InitialName".
FUNCTION HOF_HighScore_CheckEntry (HOF_Scores() AS UINTEGER, NewHighScore as UINTEGER) AS BYTE
Returns 1 if the High Score can g into the Arrays.
SUB HOF_HighScore_NewEntry (BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, NewHighScore as UINTEGER, NewHighScoreName AS STRING)
Puts the new entries (name & score) into the HOF array.
SUB HOF_Print(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING, YPOS as INTEGER, XPOS as INTEGER)
A simple print location, witch prints the Score and Names. Will carry on printing if you have many entries ...
SUB HOF_PrintSpecial(BYREF HOF_Scores() AS UINTEGER, BYREF HOF_Names() AS STRING)
A "pretty High Score screen", that prints the top 10 scores.
Can probably be improved and made much more efficient. There are porbably bugs as well (for example not sure what would happen if you had 100 entries with a first high score of 10 ... i think it's probably overflow to 655555 etc. It includes string.bas and input.bas - not sure if the library needs both of those.

