To understand how to create the High Score Board I needed to research this topic and how score boards are created for computer games. The scores need to be saved in a separate text file. The file is loaded into the structure of the memory at the beginning of the game.
I have structured the text files as follows:
Name (3 characters) Tab Score
To write the headings, “High Score Board”, “Name” and “Score” to the screen I used the sprintf code. I’ve also used the sprintf code in printing the text from the separate file to the screen.
To read the information from the separate file I have used the fscanf code. I began by pointing the computer to the relevant file and have created an integer variable to deal with the scores and a character variable to deal with the names. The code used then opens the relevant file and reads it: fileHandle – fopen(“highscores.txt”, “r”);
I then read the string, tab across, integer and create a new line. This points to the name and score strings. A copy of the name and score are then created. This process is repeated three times to then be used in displaying the names and scores of the three highest scorers.
IOCT Masters in Creative Technogies
Major Project
An augmented reality game based on "Breakout"