Time for action - updating GameBoard to support animated pieces

  1. In the declarations section of the GameBoard class, add three dictionaries:
    public Dictionary<string, FallingPiece> fallingPieces =
    new Dictionary<string, FallingPiece>();
    public Dictionary<string, RotatingPiece> rotatingPieces =
    new Dictionary<string, RotatingPiece>();
    public Dictionary<string, FadingPiece> fadingPieces =
    new Dictionary<string, FadingPiece>();
  2. Add methods to the GameBoard class to create new falling piece entries in the dictionaries:
    public void AddFallingPiece(int X, int Y, string PieceName, int VerticalOffset) { fallingPieces[X.ToString() + "_" + Y.ToString()] = new FallingPiece(PieceName, VerticalOffset); } public void AddRotatingPiece(int X, int Y, string PieceName, ...

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

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.