O'Reilly logo

XNA 4.0 Game Development by Example Beginner's Guide by Kurt Jaegers

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Time for action - update Game1 to draw animated pieces

  1. Add methods to the Game1 class to draw each potential type of game piece (animated and non-animated):
    private void DrawEmptyPiece(int pixelX, int pixelY) { spriteBatch.Draw( playingPieces, new Rectangle(pixelX, pixelY, GamePiece.PieceWidth, GamePiece.PieceHeight), EmptyPiece, Color.White); } private void DrawStandardPiece(int x, int y, int pixelX, int pixelY) { spriteBatch.Draw( playingPieces, new Rectangle(pixelX, pixelY, GamePiece.PieceWidth, GamePiece.PieceHeight), gameBoard.GetSourceRect(x, y), Color.White); } private void DrawFallingPiece(int pixelX, int pixelY, string positionName) { spriteBatch.Draw( playingPieces, new Rectangle(pixelX, pixelY - gameBoard.fallingPieces[positionName].VerticalOffset, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required