Пример #1
0
        public bool IsIntersection(int[][] figure)
        {
            if (figureYPosition == -1)
            {
                return(false);
            }
            for (int i = 0; i < figure.Length; i++)
            {
                if (figureYPosition + figure[0].Length - 1 == 19)
                {
                    return(true);
                }
                if (field.GetValueByPosition(figureXPosition + i, figureYPosition + figure[0].Length) == 1)
                {
                    return(true);
                }
            }

            return(false);
        }
Пример #2
0
        public override BGField Run(ConsoleKey key)
        {
            updateArrows();
            if (key == ConsoleKey.Spacebar)
            {
                player.Fire(Arrows);
            }
            if (PlCont == PlContMax)
            {
                if (player.update(key, field, Arrows))
                {
                    Thread.Sleep(100);
                    Create();
                }

                PlCont = 0;
            }
            if (WallPrint == WallPrintMax - Level)
            {
                wall.update(field);
                WallPrint = 0;
                counter++;
                SetScore((Level - 1) * 100 + counter);
                if (counter == 100)
                {
                    Level++;
                    SetLevel(Level);
                    if (Level >= WallPrintMax)
                    {
                        Level = WallPrintMax - 1;
                    }
                    counter = 0;
                }
            }
            PlCont++;
            WallPrint++;
            if (WallPrint > WallPrintMax)
            {
                WallPrint = WallPrintMax;
            }
            for (int i = 0; i < 10; i++)
            {
                if (field.GetValueByPosition(i, 19) == 2)
                {
                    Thread.Sleep(100);
                    Create();
                }
            }
            return(field);
        }
Пример #3
0
 private void _render(BGField bgField)
 {
     for (int i = 0; i < 10; i++)
     {
         for (int j = 0; j < 20; j++)
         {
             if (bgField.GetValueByPosition(i, j) == 0)
             {
                 PrintAtPosition(surfacePositionX + 2 + (i * 2), j + 1, "  ", ConsoleColor.White);
             }
             else
             {
                 PrintAtPosition(surfacePositionX + 2 + (i * 2), j + 1, "▣ ", ConsoleColor.Black);
             }
         }
     }
 }