saving scores
again i need advice for me game of tetris
i want the player to be able to save their scores to a text file, but i have zip idea of how to do that.
any help is apreciated
[Edited by - Sneftel on August 29, 2005 3:22:42 PM]
// writing player score to fileofstream outfile("scores.txt", ios::append);outfile << player_name << " " << player_score << endl;outfile.close();// reading player scores from fileifstream infile("scores.txt", ios::in);while(!infile.eof()){ infile >> player_name >> player_score; print(player_name); print(player_score);}infile.close();
Quote:Original post by fearfactory
but i have zip idea of how to do that.
A zip file seems to be a rather complicated solution ;)
~sorry, couldn't resist.
By the way, insead of a text file, you might consider an XML file as it allows for other possibilities like posting player results to the web and stuff like that. I don't know if your game is meant to do stuff like that, but it might make for a fun alternative to explore.
Quote:Original post by vinbStill, human readable and easily editable is generally the *last* thing you want your highscore file to be..
By the way, insead of a text file, you might consider an XML file as it allows for other possibilities like posting player results to the web and stuff like that. I don't know if your game is meant to do stuff like that, but it might make for a fun alternative to explore.
Quote:Still, human readable and easily editable is generally the *last* thing you want your highscore file to be..
Your not suggesting that people would cheat!? Your point is well taken.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement