
Can an array save the names of a player for the next game even if the game is shut down and re-started?
or should I use a 'open to write to text-file' instead?
This game would just be for a family who reside in the same house, and not for online players.
And I want to have 4 players for the game and a way to edit or delete the names to add new names.
And when they re-start the game later, I want them to be able to choose their
name on the main screen,
so they can continue where they left off, and with the same
score as they left the game last time.
I have a hard time finding a sample program the tells how to do it.
I have finished the game, and this is my one 'sticking point'
I would appreciate the help very much if anyone show a sample program?
But here's what I have so far:
+ Code SnippetUser_Controll:
`-----------------------------Enlist new PLAYER---------
name1 as string
Round_ as integer
Score as integer
setprintsize(20)
Setvirtualresolution(640,480)
If GetEditBoxExists(1)=0
CreateEditBox(1)
SetEditBoxPosition(1,250,120)
SetEditBoxCursorColor(1,0,0,0)
endif
do
name1 = GetEditBoxText(1)
print("")
print("")
Print ("Welcome, New Player ")
print (" please type your name")
print(" and press the 'return key' ")
Sync()
if GetRawKeyPressed(13) // 'Return Key'
exit
endif
loop
Write_name1_round_Total: //------------------------( also is a separate goto for saving anytime later )
file = OpenToWrite ("player1.txt",0) // ------------or put ("player1.txt",1) if you want to append to the end of each line.
sleep(20)
Writestring(file, name1)
sleep(20)
WriteInteger ( file, round_ )
sleep(20)
Writeinteger (file, Total )
sleep(20)
CloseFile ( file )
sleep(20)
SetEditBoxvisible ( 1, 0 )
setVirtualResolution(1024,768)
setprintsize(28)
Sync()
return
It is just a 'one player game' and the person plays against the computer.
So, I just need to save the names and the scores for each name. Because when the game starts again it is a 'table game' and re-organizes itself for the next 'round'.
So, yes, that's all I need is to save up to 4 names so they could, whoever wants to play it, just tap on their name again to go to the 'next round'.... that he left off.
Or to start a new round,(Level)
So, I need to save 3 things. the 'player name' and his 'Round_..(level)' that he's on and his current Total for that level.