XNA 4.0 Game Development by Example Beginner's Guide
Table of Contents
XNA 4.0 Game Development by Example Beginner's Guide
Credits
About the Author
About the Reviewers
Preface
What this book covers
What you need for this book
Who this book is for
Conventions
Time for action β heading
What just happened?
Have a go hero β heading
Reader feedback
Customer support
Errata
Piracy
Questions
1. Introducing XNA Game Studio
Overview of the games
System requirements
Installing XNA Game Studio
Time for action β installing XNA Game Studio
What just happened?
Building your first game
Time for action β creating a new Windows game project
What just happened?
Anatomy of an XNA game
The declarations area
Time for action β adding variables to the class declaration area
What just happened?
The Game1 class constructor
The Initialize() method
Time for action β customizing the Initialize() method
What just happened?
The LoadContent() method
Time for action β creating the squareTexture
What just happened?
The Update() method
Time for action β coding Update() for SquareChase
What just happened?
The Draw() method
Time for action β draw SquareChase!
What just happened?
Time for action β play SquareChase!
What just happened?
Have a go hero
Summary
2. Flood Control β Underwater Puzzling
Designing a puzzle game
Time for action β set up the Flood Control project
What just happened?
Introducing the Content Pipeline
Time for action β reading textures into memory
What just happened?
Sprites and sprite sheets
Classes used in Flood Control
The GamePiece class
Identifying a GamePiece
Time for action β build a GamePiece class β declarations
What just happened?
Creating a GamePiece
Time for action β building a GamePiece class: constructors
What just happened?
Updating a GamePiece
Time for action β GamePiece class methods β part 1 β updating
Rotating pieces
Time for action β GamePiece class methods β part 2 β rotation
What just happened?
Pipe connectors
Time for action β GamePiece class methods β part 3 β connection methods
Sprite sheet coordinates
Time for action β GamePiece class methods β part 4 β GetSourceRect
What just happened?
The GameBoard class
Time for action β create the GameBoard.cs class
What just happened?
Creating the game board
Time for action β initialize the game board
What just happened?
Updating GamePieces
Time for action β manipulating the game board
What just happened?
Filling in the gaps
Time for action β filling in the gaps
What just happened?
Generating new pieces
Time for action β generating new pieces
What just happened?
Water filled pipes
Time for action β water in the pipes
What just happened?
Propagating water
Time for action β making the connection
What just happened?
Building the game
Declarations
Time for action β Game1 declarations
What just happened?
Initialization
Time for action β updating the Initialize() method
What just happened?
The Draw() method β the title screen
Time for action β drawing the screen β the title screen
What just happened?
The Draw() method β the play screen
Time for action β drawing the screen β the play screen
What just happened?
Keeping score
Time for action β scores and scoring chains
What just happened?
Input handling
Time for action β handling mouse input
What just happened?
Letting the player play!
Time for action β letting the player play
What just happened?
Play the game
Summary
3. Flood Control β Smoothing Out the Rough Edges
Animated pieces
Classes for animated pieces
Time for action β rotating pieces
What just happened?
Time for action β falling pieces
What just happened?
Time for action β fading pieces
What just happened?
Managing animated pieces
Time for action β updating GameBoard to support animatedpieces
What just happened?
Fading pieces
Time for action β generating fading pieces
What just happened?
Falling pieces
Time for action β generating falling pieces
What just happened?
Rotating pieces
Time for action β modify Game1 to generate rotating pieces
What just happened?
Calling UpdateAnimatedPieces()
Time for action β updating Game1 to update animated pieces
What just happened?
Drawing animated pieces
Time for action β update Game1 to draw animated pieces
What just happened?
SpriteBatch overloads
SpriteFonts
Time for action β add SpriteFonts to Game1
What just happened?
Score display
Time for action β drawing the score
What just happened?
ScoreZooms
Time for action β creating the ScoreZoom class
What just happened?
Time for action β updating and displaying ScoreZooms
What just happened?
Adding the GameOver game state
Time for action β game over
What just happened?
The flood
Time for action β tracking the flood
What just happened?
Displaying the flood
Time for action β displaying the flood
What just happened?
Difficulty levels
Time for action β adding difficulty levels
What just happened?
Have a go hero
Summary
4. Asteroid Belt Assault β Lost in Space
Creating the project
Time for action β creating the Asteroid Belt Assault project
What just happened?
Another definition for "sprite"
Building the Sprite class
Time for action β declarations for the Sprite class
What just happened?
Time for action β Sprite constructor
What just happened?
Time for action β basic Sprite properties
What just happened?
Time for action β animation and drawing properties
What just happened?
Collision detection
Time for action β supporting collision detection
What just happened?
Animation and movement
Time for action β adding animation frames
What just happened?
Time for action β updating the Sprite
What just happened?
Time for action β drawing the Sprite
What just happened?
A sprite-based star field
Time for action β creating the StarField class
What just happened?
Time for action β updating and drawing the StarField
What just happened?
Time for action β viewing the StarField in action
What just happened?
Animated sprites β asteroids
Time for action β building the AsteroidManager class
What just happened?
Posi...