The Avatar Movie and Game Trailers

Wednesday, December 16, 2009

XNA is a .net language, works with the C# programming language. If you don’t know it, it’s time to start learning.

Lets create a simple 2D puzzle game using XNA.net.

If you have installed Visual Studio you must download and install XNA Game Studio 3.1 to your computer. This will add new features to your C# environment.

free download: http://www.soft82.com/download/windows/microsoft-xna-game-studio/

If you have installed them now you can start to create a new game with Visual Studio 2008.


Then you can brows the place you want and give it a suitable name.



Now you will appear a new XNA class with 5 methods.

1) protected override void Initialize()
{
base.Initialize();
}

2) protected override void LoadContent()
{
spriteBatch = new SpriteBatch(GraphicsDevice);
}


3) protected override void UnloadContent()
{

}


4) protected override void Update(GameTime gameTime)
{
if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed)
this.Exit();

base.Update(gameTime);
}


5) protected override void Draw(GameTime gameTime)
{
GraphicsDevice.Clear(Color.CornflowerBlue);

base.Draw(gameTime);
}


When you running the program first three methods will called once and other two methods(Draw() and Update() methods) will call again and again as a newer ending wile loop.


Blogspot Templates by Isnaini Dot Com. Powered by Blogger and Supported by Lincah.Com - Mazda Cars