Esempio n. 1
0
        static void Main(string[] args)
        {
            Console.CursorVisible = false;
            TetrisGame game = new TetrisGame();

            game.RePrintGame();
            FigurePosKeyPressed += game.SetNewDirection;
            RotateFigureEvent   += game.RotateFigure;
            Thread keyReader = new Thread(new ThreadStart(KeyReader))
            {
                Name = "KeyPressRegister"
            };

            keyReader.Start();
            game.CreateNextFigure();
            while (true)
            {
                Tick(delay, game);
            }
        }
Esempio n. 2
0
        public static void CheckRows(TetrisGame game)
        {
            int multyplayer  = 0;
            int blockcounter = 0;

            for (int i = 0; i < 20; i++)
            {
                blockcounter = 0;
                for (int j = game.deltaX + 1; j < 10 + game.deltaX + 1; j++)
                {
                    if (game.gameField[i, j] == Block.block)
                    {
                        blockcounter++;
                    }
                }
                if (blockcounter == 10)
                {
                    multyplayer += 1;
                    RowHandler.DeleteRow(game, i);
                }
            }
            game.score += game.scoreDelta * multyplayer;
            game.RePrintGame();
        }