Time for action – build a GamePiece class – declarations
Switch back to your Visual C# window if you have your image editor open.
Right-click on Flood Control in Solution Explorer and select Add | Class…
Name the class GamePiece.cs and click on Add.
At the top of the
GamePiece.cs
file, add the following to theusing
directives already in the class:using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework;
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; private const int textureOffsetX = 1; private const int textureOffsetY = 1; private const int texturePaddingX = 1; private const int texturePaddingY = 1; private string pieceType = ""; ...