On I-pad, how could my video game record the last score of a game, and later, (like 1 month later or whatever), the player can retrieve it to see his last score?
Like, I know I could print it on the screen or whatever, if he presses a key.
But how could I code it so that the game will both write the score and then could retrieve it later? That is my problem. I keep getting error messages ...(File already exists) and (File already opened for writing).
Oh, here's the answer to that:
`comment Write
ThisFile = OpenToWrite("highscore.dat",0)
WriteInteger(ThisFile,Score)
CloseFile(ThisFile)
`comment Read
If GetFileExists("highscore.dat") = 1
ThisFile = OpenToRead("highscore.dat")
High = ReadInteger(ThisFile)
CloseFile(ThisFile)
else
High = 0
endif
But now I have one more question....
What if I want to record player top 10 scores?
How do I write to 9 more lines below the first score?
Or, how can my code write to any line I want it to?
Is there a special 'line command' for files of this type?