O'Reilly logo

Beginning 3D Game Programming by Tom Miller

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

Implementing the Level

Before you can start implementing the level, you need to add a new code file to your project to hold the level's code. You can call this file level.cs and add it to your project now. The initial implementation of your level class appears in Listing 8.1.

Listing 8.1. The Level Class
 public class Level { private const float Spacing = 3.35f; private const int SquareSize = 13; private const float StartingLocation = (Spacing * SquareSize) / 2.0f; // The list of blocks that comprise the level private Block[] blocks = null; // The final color to win private BlockColor finalColor; // Store the player private Player currentPlayer = null; // Block index of the player private int playerIndex; // Total number of moves made so far ...

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