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

Get Beginning 3D Game Programming 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.