Building an XNA Game part 2 of a gazillion or so parts

Let's see if my aluminum foil hat is in position...yes it is.  At the end of the last post you should have been able to run your first game and see a screen that looks like the following:

image Not to be mistaken for the blue screen of death, you are viewing your first game: The Blue Game.  This is the simplest game, and it doesn't do anything except glow a beautiful cornflower blue.  What is happening with the XNA Express game template?  How do we change the color? 

First, this shouldn't be confused with the Windows Form where you would drag and drop objects like a button or textbox on a form and then use events to respond to user or programmatic input.

In this case, the XNA Express program that you created uses the line (in the Draw method of the class Game1.cs)

 

Here is what is in the Game1.cs class, there are many examples in the help files, this discussion is for reading only, use the examples in the XNA Express help file to get your game working.  Over the next gazillion parts of this discussion, we will create a working Pong game and move into 3D games.

The Initialize method is where you can initialize any assets that do not require a GraphicsDevice to be initialized.

For example: You may want to reset the game each time it starts, or you may want to load the previous state of game play. 

The LoadGraphicsContent method is where you load any graphical assets such as models and textures.

Here you would load images such as game pieces, backgrounds and so forth

The UnloadGraphicsContent method is where any graphical assets can be released. Generally, no extra code is required here, as assets will be released automatically when they are no longer needed.

Use this method to remove the images you loaded using the LoadGraphicsContent

The Update loop is the best place to update your game logic: move objects around, take player input, decide the outcome of collisions between objects, and so on.

In the Update method you would include code that would call methods in classes to do game logic. The Update method is called in sequence with the Draw loop.  In the Update method, you could call the gamepad objects to allow the user to move an object on the screen.

The Draw loop is the best place to render all of your objects and backgrounds on the screen.

Code that you would use in the Draw method or loop:

//The following code is entered by the template

GraphicsDevice device = graphics.GraphicsDevice;

//Change CornflowerBlue to some other color, this will change the background color of your "Blue Game"

            device.Clear(Color.CornflowerBlue);

//The following code could be entered by your creativity and typing:

            DrawModel(shipModel, ship.World);
            DrawModel(groundModel, Matrix.Identity);

            DrawOverlayText();

As an aside, just how does the Xbox support drawing?

The Xbox 360 has 10 MB (10×1024×1024) of fast embedded dynamic RAM (EDRAM) that i

Technorati Tags: XNA express , XBOX 360 , Game Design , Halo 3 , Halo , Halo2 , Halo3

s dedicated for use as the back buffer, depth stencil buffer, and other render targets.

As to Halo3, California State University, Fullerton and California State University, Channel Islands held an online battle, with CSUF winning against CSUCI, making CSUF the first University in the CSU system to win a Halo3 tournament against another Cal State school. Of course, CSUCI is likely to be ready to take back that title!

Well that is it for now, eventually we will dig into the SpaceWars game and start simulating our MoteAI visitors from another solar system...