Time for action – build a GamePiece class – declarations

  1. Switch back to your Visual C# window if you have your image editor open.
  2. Right-click on Flood Control in Solution Explorer and select Add | Class…
  3. Name the class GamePiece.cs and click on Add.
  4. At the top of the GamePiece.cs file, add the following to the using directives already in the class:
    using Microsoft.Xna.Framework.Graphics;
    using Microsoft.Xna.Framework;
  5. In the class declarations section, add the following:
     public static string[] PieceTypes = { "Left,Right", "Top,Bottom", "Left,Top", "Top,Right", "Right,Bottom", "Bottom,Left", "Empty" }; public const int PieceHeight = 40; public const int PieceWidth = 40; public const int MaxPlayablePieceIndex = 5; public const int EmptyPieceIndex = 6; ...

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.