If you read my blog on a regular basis, I deeply appreciate you as a reader, thank you for returning. I am depressed somewhat about the events of the day, which I won’t mention, but you know what I am talking about. Anyway….
In a class that I teach at Cal State Dominguez Hills, my unfortunate students have to suffer with my blathering for hours on end. But it does require that I prepare from time to time for the class and I have been using the Catapult tutorial because I had been told that it is a “beginner” tutorial. I never worked through it till today, and I suddenly realized that my students were very patient with me, so thank you students. I need to break this down, because 50 pages of anything, unless it is like one sentence per page, is too long. So until I get bored with this whole idea or I work through everything I am going to work through the catapult tutorial.
So first, to get the assets and code that I will use, download the catapult app project from :
Make sure to right click on the zip file to insure that the file is unblocked, by clicking on the Unblock button. If you don’t see the unblock button then that is ok.
The Catapult tutorial is an excellent tutorial, but like a lot of tutorials the tutorial states that you can complete it in 90 minutes. Right, that is if you have no questions and aren’t thinking about what you are doing. If you are trying to figure out how, what and why, then it takes quite a bit longer.
I will generally assume that you will be able to create an XNA game project. If not you can start with the referenced tutorial and then switch to this when it gets complicated.
Now create a project that is named “SimpleGameManagement”
We will use the following files:
Make sure your solution explorer looks like the Solution Explorer as shown
Once you have added the Game Management files, we will rework the project files.
For the Windows Phone you do not need the Project.cs file, so delete it to clean things up.
Change Game1.cs to SimpleGame.cs and select that it is ok to change the project.
Create a new class named SimpleGameManagement and paste the code below, replacing the default code: The comments are included to explain the code, but if you are doing code for industry, you should keep your comments short and pithy. Don’t use the “flower” approach that I use, why? Because you will have to maintain them and that takes time. There is more code and explanation below the code shown below:
In the original game class module replace the code with the following, you most likely notice that the Initialize, LoadContent, Draw and Update methods are replaced with the ScreenManager object in the GameStateManagement namespace.
You can use any PNG for your image, the ugly spud that I used was a clipart from Office.