Oh crud, the tutorial says it will take 90 minutes but is 91 pages long.  Really?

Sometimes I look at the well done tutorials you can find at http://create.msdn.com, for instance the Game Management tutorial found at:

http://create.msdn.com/en-US/education/catalog/sample/game_state_management

This tutorial says that the “estimated time to complete this lab: 90 minutes”, with the exception of that statement, this is very well written lab.  Unless you are read fast and type faster, I am not quite sure how a document that is 91 pages can take only 90 minutes to do?  Really, anything other than a quick read can be done in 90 minutes.  Also, what is not written in the lab is important as well: How do I reuse this material?  Isn’t that why you are doing these labs?

Ok, in my previous blog, which should have taken an estimated 300 seconds to read through and do the instructions, then synthesis the knowledge and be able to create games that can be sold for millions of dollars, all in 300 seconds.  Note that it was an estimated 300 seconds which means that it might take longer.  Yeah right.  So if you are wondering why it took you longer than 90 minutes for the Game State Management Lab, that is perfectly normal, I took about 3 hours the first time through and still didn’t see how I could use it easily.  So I spent more time re-reading it.

This blog will take an estimated 90 nanoseconds to read and incorporate the knowledge into the way you do things.

Actually the last blogs was an attempt to very simply show you how to place an image (or picture) on the screen of the phone emulator.

This blog will take a longer period of time, and it might stick with your for the rest of your life.  Scary right?

So at the end of the last blog you should have the following (or similar, you might have used a different image, different vector, etc.):

image

So now you have an image, using a vector, what about the Rectangle?

If you make the following change, the image will be presented using a Rectangle, which is cool because it has a way to test for collisions, and collisions is what it is all about with games!

Find this line and make these changes:

At the top of the code add this variable after the Vector2 v_Dracula line;

Code Snippet
  1. Rectangle r_Darcula;

In the LoadAssets method, add the following line after the v_Dracula line:

Code Snippet
  1. r_Darcula = new Rectangle(10, 10, 100, 100);

After the following line:

Code Snippet
  1. ScreenManager.SpriteBatch.Draw(t_Darcula, v_Darcula, Color.White);

Add:

Code Snippet
  1. ScreenManager.SpriteBatch.Draw(t_Darcula, r_Darcula, Color.White);

Run the code and you should see the two images, the upper left one is the image in a a rectangle and the larger one is the one using a vector:

image