Exemplo n.º 1
0
        public void RotatePiece()
        {
            int NewRotation = Rotacion;

            if (NewRotation == 3)
            {
                NewRotation = 0;
            }
            else
            {
                NewRotation++;
            }

            Point[] SendPiece = new Point[4];
            for (int i = 0; i < 4; i++)
            {
                SendPiece[i] = Forma[PiezaActual, NewRotation, i];
            }

            if (!Playground.CheckCollisionMove(SendPiece, x, y))
            {
                Available = false;
                Erase(x, y, PiezaActual);
                Rotacion = NewRotation;
                Sonidos.PlaySound(Sonidos.Sounds.Rotar);
                Draw(x, y, PiezaActual);
                Playground.SensibilizeCell(x, y, Height, Width);
            }
            else
            {
                Sonidos.PlaySound(Sonidos.Sounds.Topa);
            }
        }
Exemplo n.º 2
0
 private static void CheckIfLose()
 {
     for (int i = 1; i < 11; i++)
     {
         if (Matriz[i, 4])
         {
             Sonidos.StopBGM();
             Sonidos.PlaySound(Sonidos.Sounds.Pierde_1);
             for (int j = 23; j > 0; j--)
             {
                 Console.SetCursorPosition(1, j);
                 Console.Write("KBKBKBKBKB");
                 Thread.Sleep(20);
             }
             for (int j = 1; j < 24; j++)
             {
                 Console.SetCursorPosition(1, j);
                 Console.Write("          ");
                 Thread.Sleep(20);
             }
             Sonidos.PlaySound(Sonidos.Sounds.Pierde_2);
             Lose = true;
             ConsoleFunctions.WriteConsoleInput('\0');
             break;
         }
     }
 }
Exemplo n.º 3
0
        private static void EatLines(int[] CompleteLines)
        {
            DeSensibilizeCell();
            switch (CompleteLines.Length)
            {
            case 1: Sonidos.PlaySound(Sonidos.Sounds.Single);
                Score += 40 * (Level + 1);
                Lines += 1;
                break;

            case 2: Sonidos.PlaySound(Sonidos.Sounds.Double);
                Score += 100 * (Level + 1);
                Lines += 2;
                break;

            case 3: Sonidos.PlaySound(Sonidos.Sounds.Triple);
                Score += 300 * (Level + 1);
                Lines += 3;
                break;

            case 4: Sonidos.PlaySound(Sonidos.Sounds.Tetris);
                Score += 1200 * (Level + 1);
                Lines += 4;
                FlashScreen();
                break;
            }
            for (int h = 0; h < CompleteLines.Length; h++)
            {
                Console.SetCursorPosition(1, CompleteLines[h]);
                for (int q = 1; q < 11; q++)
                {
                    Console.SetCursorPosition(q, CompleteLines[h]);
                    Console.Write(" ");
                    Thread.Sleep(15);
                }
                for (int i = CompleteLines[h]; i > 1; i--)
                {
                    for (int j = 1; j < 11; j++)
                    {
                        Matriz[j, i] = Matriz[j, i - 1];
                    }
                }

                Console.MoveBufferArea(1, 4, 10, CompleteLines[h] - 4, 1, 5);
                for (int k = h + 1; k < CompleteLines.Length; k++)
                {
                    CompleteLines[k] += 1;
                }
                Sonidos.PlaySound(Sonidos.Sounds.Linea_Cae);
            }
            UpdateStatus();
            Thread.Sleep(200);

            //Draw(20,0);
        }
Exemplo n.º 4
0
 public void MoveRight()
 {
     Point[] SendPiece = new Point[4];
     for (int i = 0; i < 4; i++)
     {
         SendPiece[i] = Forma[PiezaActual, Rotacion, i];
     }
     UpdatePieceDimentions();
     if (x + Width != 11 && !Playground.CheckCollisionMove(SendPiece, x + 1, y))
     {
         Available = false;
         Erase(x, y, PiezaActual);
         x++;
         Draw(x, y, PiezaActual);
         Playground.SensibilizeCell(x, y, Height, Width);
     }
     else
     {
         Sonidos.PlaySound(Sonidos.Sounds.Topa);
     }
 }
Exemplo n.º 5
0
 public static bool CheckCollisionFall(Point[] Pieza, int x, int y)
 {
     for (int i = 0; i < 4; i++)
     {
         if (Matriz[Pieza[i].X + x, Pieza[i].Y + y])
         {
             for (int j = 0; j < 4; j++)
             {
                 Matriz[Pieza[j].X + x, Pieza[j].Y + y - 1] = true;
             }
             Sonidos.PlaySound(Sonidos.Sounds.Topa);
             Thread.Sleep(200);
             Sonidos.PlaySound(Sonidos.Sounds.Posicionada);
             Score += 6 * (Level + 1);
             UpdateStatus();
             LineControl();
             CheckIfLose();
             return(true);
         }
     }
     return(false);
 }
Exemplo n.º 6
0
 public static void UnPause()
 {
     Sonidos.PlaySound(Sonidos.Sounds.Pausa);
     Sonidos.ContinueBGM();
 }
Exemplo n.º 7
0
 public static void Pause()
 {
     DeSensibilizeCell();
     Sonidos.PlaySound(Sonidos.Sounds.Pausa);
     Sonidos.PauseBGM();
 }