public static void ShowHighScores() { Engine.ClearScreen(); showControls = true; do { Console.BackgroundColor = ConsoleColor.DarkBlue; Console.ForegroundColor = ConsoleColor.Red; Console.SetCursorPosition(0, 0); Engine.ClearScreen(); for (int i = 0; i < highScoresNames.Length; i++) { Console.SetCursorPosition(30, 10 + i); Console.WriteLine($"{i + 1} {highScoresNames[i]} {highScoresNumbers[i]} \n\n"); } BlockAnimation(); Thread.Sleep(50); showControls = Engine.EscapeNotPressed(); } while (showControls); // to prevent draw bug keypress Engine.GlitchFix(); }
static public void PlayGame() { Hud.Score = 0; level = 1; int dropSpeed = 20; isPlaying = true; TetrisBlock activeBlock = new TetrisBlock(); playField = new PlayField(); Engine.ClearScreen(); SetCursorPosition(0, 0); while (isPlaying) { tick++; KeyInputCheck(activeBlock, playField); if (tick % (dropSpeed - level) == 0) { activeBlock.YPos++; tick = 0; } if (playField.CollisionCheck(activeBlock)) { playField.UpdateField(activeBlock); playField.ScoreCheck(); // game over if (playField.CollisionCheck(activeBlock) && isPlaying) { HighScores.CheckHighScore(Hud.Score); isPlaying = false; } } Hud.DrawHud(); playField.DrawPlayField(xOffset, yOffset); activeBlock.DrawBlock(xOffset + activeBlock.XPos, yOffset + activeBlock.YPos); Thread.Sleep(40); } // remove keyboard input glitch Engine.GlitchFix(); }
public static void ShowCredits() { Engine.ClearScreen(); Console.ForegroundColor = (ConsoleColor)random.Next(9, 15); showCredits = true; do { Engine.ClearScreen(); PrintName(); Animation(); Thread.Sleep(50); showCredits = Engine.EscapeNotPressed(); } while (showCredits); Engine.GlitchFix(); }
public static void ShowControls() { string control = @"==========+OOOOOOOOOOO======$$$$$$$O888888===~~~~~~~~$$7ZOOOIIIIIII........... . =============$OOOOOOOO======$$$$$$$O88888OI+~~~~~~~~~~~~$IIIIIIIIIIII+... . .. . OOI============+OOOOOO======$$$$$$$O88O?IIII?I+=~~~~~~~~~~~IIIIIIIIIIIII?...... OOOOZ===========IIIOO8======$$$$$$$$?IIIIII?IIIII=~~~~~~~~~~~+IIIIIIIIIIIII~.. . OOOOOOOO========+IIII7======$$$$$$$$$$IIIIIIIIIIIIII=~~~~~~~~~~~+IIIIIIIIIIIII~. OOOOOOOZ$=======+IIIII======$$$$$$$$$$$$$IIII?IIIIIIIII=~~~~~~~~~~~?IIIIIIIIIIII ZOOOZ$$$$========IIIII======$$$$$$$$$$$$$$$$IIIIIIII?IIIII=~~~~~~~~~~~+IIIIIIIII II$$$$$$$===*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM7*~~~?IIIIII II$$$$$$$==*MM Quit MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*~~~~~~IIII II$$$$$$7==*MM \/ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*~~~===?$7$ II$$$$=====*MM /\ MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMII?*=====+$7$ ~?7+=======*MM Back MMMMMMMMMMMMMMMMMM Pause MMMMMMMMMMMMMMMMMMO88*=====+7$$ ~~=========*MMMMMMMMMMMMMMMMMMMMMMMMMMMM | MMMMMMMMMMMMMMMMMM888*======777 ~~=========*MMMMMMMMMMMMMMMMMMMMMMMMMMMM <-- MMMMMMMMMMMMMMMMMM888*+=====$$7 ~~======~..*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMM888*========= ~=====.....*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMM MMMMMMMMMMMMMMMMMM887*========= ===........*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM ^ MMMMMMMMMMM*========= ... ......*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM | MMMMMMMMMMM*========= ..... ....*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM rotate MMMMMMMMMMM*======+.. ... . ..*MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM*=+... . . ===+... ...*MM7 MM MN down MO MMM*=+...... =======....*MM drop block MM left Z | M right MMM*... ... =========:.*MM spacebar MM <-- Z v M --> MMM*...... .. ===========*MMO MM MM MD MMM*......~~~ ===========*7MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM7*.:~~~~~~~ OOZOO=========+777+++++??+?++???????????:,:::::,:::,,,+++====++++~~~~~~~~~~~~~~~ ZOZOOOO$=======IIIII?================:.............~~=~~~~~~~~~==~~~~~~~~~~~~~~I OOOOOOO$$======IIII?III7=============+...........===~~~~~~~~=IIII~~~~~~~~~===$II OOOO$$$$7======?IIIIIII$$7?=============+........=====~~=~IIIIIIIIII~~~======$$$ II$$$$$$$=======IIIIIII$$$$$$I=============+.....=======7IIIIIIIIIIII7======+$$$ II$$$$$$$==========7III$$$$OOOOO===============..=======$$$7IIIIII8887=======$$$ II$$$$$$$=============I$OOOOOOOOOO8=====================$$$$$$7888888Z=======$$$ II$$$$OOOOO?============+OOOOOOOOOOOOO+=================$$$$$$$OOO888$====~~~~7$ II$OOOOOOOOOOO$========+===+OOOOOOOOOOOOZ===============$$$$$$$8888O8Z+~~~~~~~~~"; Console.Clear(); Console.ForegroundColor = ConsoleColor.DarkGray; bool gray = true; for (int i = 0; i < control.Length; i++) { if (control[i] == '*' && gray == true) { Console.ForegroundColor = ConsoleColor.White; gray = false; } else if (control[i] == '*') { Console.ForegroundColor = ConsoleColor.DarkGray; gray = true; } Console.Write(control[i]); if (i % 80 == 0) { Thread.Sleep(1); } } do { } while (Console.ReadKey().Key != ConsoleKey.Escape); Engine.GlitchFix(); }