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

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