Пример #1
0
        private void showHelp()
        {
            Console.Clear();

            ChangeConsoleColors.to_info_ForegroundColor();
            ChangeConsoleColors.to_info_BackgroundColor();

            Console.SetCursorPosition(0, 5);
            Console.Write("\tControls:\n");
            Console.Write("\tUp: Rotate\n");
            Console.Write("\tLeft: Move Left\n");
            Console.Write("\tRight: Move Right\n");
            Console.Write("\tDown: Move Down by three lines\n\n");

            Console.Write("\tRules:\n");
            Console.Write("\tJust try to fill up every row.\n"
                          + "\tPoints are earned one by one by filling up every row.\n"
                          + "\tLevel increased by earning every 5 Points.\n"
                          + "\tThe falling Down speed of every shape will be increased\n"
                          + "\twith the increment of Level\n");

            Console.SetCursorPosition((Console.WindowWidth / 2) - 12, Console.CursorTop + 2);
            Console.Write("press any key to get back ......");
            Console.ReadKey();

            ChangeConsoleColors.to_Console_Default_BackgroundColor();
            ChangeConsoleColors.to_Console_Default_ForegroundColor();
        }
Пример #2
0
        private void showCredits()
        {
            Console.Clear();

            ChangeConsoleColors.to_info_BackgroundColor();
            ChangeConsoleColors.to_info_ForegroundColor();

            Console.SetCursorPosition(10, 5);
            Console.Write("Mohaimin Morsalin");

            Console.SetCursorPosition(10, Console.CursorTop + 1);
            Console.Write("United International University (CSE 121)");

            Console.SetCursorPosition(10, Console.CursorTop + 1);
            Console.Write("Dhaka, Bangladesh.");

            Console.SetCursorPosition(10, Console.CursorTop + 1);
            Console.Write("Email: [email protected]");

            Console.SetCursorPosition((Console.WindowWidth / 2) - 12, Console.CursorTop + 2);
            Console.Write("press any key to get back ......");
            Console.ReadKey();

            ChangeConsoleColors.to_Console_Default_BackgroundColor();
            ChangeConsoleColors.to_Console_Default_ForegroundColor();
        }
Пример #3
0
 /// <summary>
 /// adjustConsole() function will adjust and manage the console screen
 /// such as foreground background color, window size, cursor visibility
 /// </summary>
 private static void adjustConsole()
 {
     Console.Title = "Tetris Game";
     ChangeConsoleColors.to_Console_Default_BackgroundColor();
     ChangeConsoleColors.to_Console_Default_ForegroundColor();
     Console.SetWindowSize(80, 45);
     Console.CursorVisible = false;
 }
Пример #4
0
        /// <summary>
        /// startGame() a function that will build bucket and sidebar,
        /// change the console foreground background color by calling the respective function.
        /// Then let user play the game by calling play() function.
        /// After playing it changes the score, level and console color to their initial value.
        /// </summary>
        public void startGame()
        {
            Bucket.buildBucket();
            score = 0;
            level = 1;
            buildSidebar();

            ChangeConsoleColors.to_Bucket_BackgroundColor();
            ChangeConsoleColors.to_Bucket_ForegroundColor();

            playGame();

            ChangeConsoleColors.to_Console_Default_BackgroundColor();
            ChangeConsoleColors.to_Console_Default_ForegroundColor();
        }
Пример #5
0
        /// <summary>
        /// Just coloring the bucket Area.
        /// </summary>
        private static void colorBucketArea()
        {
            ChangeConsoleColors.to_Bucket_BackgroundColor();

            for (int i = 1; i < bottomEnd - topEnd; i++)
            {
                Console.SetCursorPosition(leftEnd, topEnd + i);

                for (int j = 1; j <= rightEnd - leftEnd + 1; j++)
                {
                    Console.Write(" ");
                }
            }

            ChangeConsoleColors.to_Console_Default_BackgroundColor();
        }