I am working on a scoreboard function for my game in which the player inputs there name and then that is written to a text file as the scores. I have managed write to the file and display it again. But it only writes one name which currently gets overwritten every time a new name is entered. So how would I fix this? I have tried doing:
f = open('names.txt')
f.writeline(str(name))
f.close()
Here is what I am trying to get:
Name1
Name2
Name3
So how would I do a different line for each name? Thank you
I can add in multiple names but here is what happens:
The text file appears correctly but in pygame it appears incorrectly. I want it to be on separate lines like the text file.