CREATE 2D GAME YOURSELF TUTORIAL 1
After successfully installing Visual Studio .net and Microsoft XNA Game Studio, we can start to create Window base game or XBOX360 base game our self.
1st step:
All programs-> Microsoft XNA Game Studio
After open XNA Game studio go to
File->New->Project or (ctr+shift+N)
Now it selects XNA Game Studio under Visual C#. And select Windows Game check figure 1.
Figure 1 show that selects Windows Game.
In here you should provide the name for the game which going to create and should provide the location to save the project after that press OK button.
2nd step:
Now you can see Solution Explorer. Check Figure 2.
Figure 2
Now it is better to know about the Game.cs file. By clicking on that you can see it has basically Five methods already. Now on here we can create game using that already created methods.
1) Initialize() -(Provide Game initial information)
2) LoadContent()- (Using that load resource files such as images,videos,sound files,font and so on)
3) UnloadContent()-(Using that we can unload resource which we load using LoadContent() method)
4) Update(GameTime gameTime) –(use to update action are goes here)
5) Draw(GameTime gameTime) – (Use to draw resource which we added)
Now I think you have some idea about how the game create procedure is going. Let’s check how to add image to our Game project.
How to add image to Game Project
Before you can start drawing backgrounds, characters, or so on having in your game to the screen, you will need to add these images to your game project. The image types you can add that are supported by the Content Pipeline are .bmp, .jpg, .png and a few texture file formats. Adding the images to your project makes them available to the XNA framework's Content Importer. This will compile them as ".xnb" files when you build your game and make them accessible to the Content Importer in the code for loading and unloading.
3rd step:
To add image to game project, Right click on Content and should provide existing items. Check figure 3.
Figure 3.
Now you can brows and able to provide image to your game project. After providing image path now you can see the image which you added is added to Content Pipeline. Check Figure 4.
Figure 4
Now you have added image. And next go to Game.cs and should provide added images reference. For that should use Texture2D mickymouse2D;
Next using above added reference we must load that image to our game project for that go to LoadContent() methods and add following line mickymouse2D = Content.Load




0 comments:
Post a Comment