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, ...

Get XNA 4.0 Game Development by Example Beginner's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.