Exemplo n.º 1
0
 /// <summary>
 /// The main entry point for the application.
 /// </summary>
 static void Main(string[] args)
 {
     using (Game1 game = new Game1())
     {
         game.Run();
     }
 }
Exemplo n.º 2
0
        public Grid(Game1 game, String layoutFile, int gridHeight, int gridWidth)
        {
            this.gridHeight = gridHeight;
            this.gridWidth = gridWidth;

            //Load out the text file into a string
            sr = new StreamReader(layoutFile);
            strLayout = sr.ReadToEnd();
            sr.Close();

            //Get number of columns
            sr = new StreamReader(layoutFile);
            numCellsWide = sr.ReadLine().Length;
            sr.Close();

            cellWidth = this.gridWidth / numCellsWide;

            //Get number of rows
            numCellsHigh = strLayout.Length / numCellsWide;
            cellHeight = this.gridHeight / numCellsHigh;

            //Create your grid array
            grid = new Block[numCellsHigh, numCellsWide];

            //Initialize your grid
            this.Init(game);
        }
Exemplo n.º 3
0
 public Stone(Game1 game, Grid grid, String image, int x, int y)
     : base(game, grid, image, x, y)
 {
 }
Exemplo n.º 4
0
        private void Init(Game1 game)
        {
            int count = 0;

            for (int i = 0; i < numCellsHigh; i++)
            {
                for (int j = 0; j < numCellsWide; j++)
                {
                    while(strLayout[count] == '\r' || strLayout[count] == '\n')
                    {
                        count++;
                    }
                    switch (strLayout[count])
                    {
                        //Enter your block symbols here
                        case '-':
                            grid[i, j] = new Stone(game, this, "Stone", j, i);
                            count++;
                            break;
                        default:
                            grid[i, j] = null;
                            count++;
                            break;
                    }
                }
            }
        }
Exemplo n.º 5
0
 public Block(Game1 game, Grid grid, String image, int x, int y)
 {
     texture = game.Content.Load<Texture2D>(image);
     position = grid.GetPosition(x, y);
 }