Jump to content
Xtreme .Net Talk

Recommended Posts

Posted
I'm creating a game, and I want the user to be able to Save the game. And I only want 1 Save Slot. Now how could I save the players position (just what stage that person is in. aka: 1 or 2 or 3) and then save that information within the .exe without creating a saved file within the application's directory inside of the user's computer?
"Reality is fake, Dreams are for real"
Posted

Oohhh I guess I can save it in a saved file :rolleyes:

 

But how would I go about doing that? I only want like 1 integer in the saved file to understand where the person is at in the game :p

"Reality is fake, Dreams are for real"
  • *Experts*
Posted

You might want to look into using XML Serialization. That way you could create a GameState class or something, store the current level, score, and anything else you want to save, and simply serialize it into an XML file. Then you just deserialize it back into a GameState object when you are ready to get the data again, and use the properties of the class. Look in the MSDN for information about XML Serialization for that.

 

However, if you just want to save it in a file, there are many examples in the MSDN as well. Look for the StreamReader and StreamWriter classes, as well as the System.IO namespace.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...