Time for action – creating the Asteroid Belt Assault project
Visit http://www.PacktPub.com and download the 0669_04_GRAPHICPACK.ZIP file. Extract the file to a temporary location.
Open Visual Studio Express Edition and create a new XNA 4.0 Windows Game project called Asteroid Belt Assault.
In the Asteroid Belt AssaultContent project, right-click on the project name, select Add | New Folder and add a folder called
Textures
. Add another folder calledFonts
.Right-click on
Textures
and add theSpriteSheet.png
andTitleScreen.png
files from the graphics pack to the project.Add declarations to the
Game1
class for game states and textures:enum GameStates { TitleScreen, Playing, PlayerDead, GameOver}; GameStates gameState = GameStates.TitleScreen; Texture2D titleScreen; Texture2D spriteSheet;
Update the
LoadContent()
method to load the sprite sheet:titleScreen = Content.Load<Texture2D>(@"Textures\TitleScreen"); spriteSheet = Content.Load<Texture2D>(@"Textures\spriteSheet");
Add a basic structure...