Exemple #1
0
        public void Update(GameTime gameTime)
        {
            curTetromino.Update(gameTime);

            if (curTetromino.isLanded)
            {
                SaveTetromino(curTetromino);

                if (curTetromino.GetMinPosition(curTetromino.positions).Y <= 0)
                {
                    //GameOver();
                }
                else
                {
                    Console.WriteLine(curTetromino.GetMinPosition(curTetromino.positions).Y + " : Y pos");

                    curTetromino = new Tetromino(this);
                    curTetromino.LoadContent();
                }
            }

            int rowsFilled = 0;

            //Check if any row is filled
            for (int i = 0; i < height; i++)
            {
                bool isFilled = true;
                for (int j = 0; j < width; j++)
                {
                    if (arena[j, i] == 8)
                    {
                        isFilled = false;
                    }
                }

                if (isFilled)
                {
                    DeleteRow(i);
                    rowsFilled++;
                }
            }

            if (rowsFilled != 0)
            {
                score += rowsFilled * (rowsFilled * 5 + 50);
            }
        }
Exemple #2
0
 public void LoadContent()
 {
     arenaTexture = Assets.TETRIS_ARENA;
     font         = Assets.SCORE_FONT;
     curTetromino.LoadContent();
 }