I am doing 2D game using XNA framework 4.0. I'd like the game to have multiple levels. Where do I store the levels and how do I implement a scoring system for the game? Can I use XML for storing data for that levels and scores? Finally, is there any code samples for a multiple level game in Windows phone 7 using XNA 4.0?
See the platformer kit on the app hub. Includes Xbox, PC, and WP7.
It has examples of what you are asking (including XML levels).
Well, you can store games in the content folder (make sure to set them to compile:none in the item properties) and then load them using
[Microsoft.Xna.Framework.Storage.TitleLocation + Content.RootDirectory + file_name]
using something like StreamReader or XML (it also does not have to be in the content folder but just the game root directory). To load them, either hard code their names into the game or name the files like 1.level, 2.level, etc.
You can store arbitrary XML files in the XNA asset manager but remember to set the compiling off for those files (so the remain as plain text and don't get saved as binary files). You can see an example in my open source game Urban Race. It's 3D but the concept still applies, I read XML for the levels at runtime, just what you want.