Ejemplo n.º 1
0
        private void Tetris_OnUpdateGame(Controller controller)
        {
            switch (controller.GameKey)
            {
            case GameKey.Up:
                active.RotationRight(passive);
                break;

            case GameKey.Down:
                Iteration();
                Iteration();
                break;

            case GameKey.Left:
                active.TetrisMove(-1, 0, passive);
                break;

            case GameKey.Right:
                active.TetrisMove(1, 0, passive);
                break;
            }
            if (iteration = !iteration)
            {
                Iteration();
            }
            DrawField();
            if (passive.Cross(active))
            {
                GameOver();
            }
        }
Ejemplo n.º 2
0
            public void RotationRight(TetrisFigure passive)
            {
                TetrisFigure temp = new TetrisFigure(this);

                temp.RotationRight();
                if (!passive.Cross(temp) && temp.X >= 0 && temp.body.Max(x => x.X) < 10 && temp.body.Max(x => x.Y) < 20)
                {
                    RotationRight();
                }
            }