static int MainMenu(int playthegame) { #region CREATETITLE ScreenWindows.DisplayTextboxMain(); Console.SetCursorPosition(55, 12); Console.Write("-=|Slime Fighter|=-"); Console.SetCursorPosition(59, 13); Console.Write("-THE GAME-"); Console.SetCursorPosition(57, 18); Console.Write("By:John Sabins"); #endregion // //------------------====MENU OPTIONS====----------------- // ConsoleKeyInfo keyPress; int tOb = 25; int tObLast = 25; bool optionSelected = false; Console.SetCursorPosition(55, 25); Console.Write("Start Fighting!"); Console.SetCursorPosition(55, 27); Console.Write("Quit Game"); Console.CursorVisible = false; Console.SetCursorPosition(52, tOb); Console.Write("->"); while (!optionSelected) { keyPress = Console.ReadKey(); if (keyPress.Key == ConsoleKey.UpArrow) { tOb = 25; Console.SetCursorPosition(52, tObLast); Console.Write(" "); Console.SetCursorPosition(52, tOb); Console.Write("->"); tObLast = tOb; playthegame = 1; } if (keyPress.Key == ConsoleKey.DownArrow) { tOb = 27; Console.SetCursorPosition(52, tObLast); Console.Write(" "); Console.SetCursorPosition(52, tOb); Console.Write("->"); tObLast = tOb; playthegame = 2; } if (keyPress.Key == ConsoleKey.Enter) { optionSelected = true; } Console.SetCursorPosition(52, tObLast); } return(playthegame); }
/// <summary> /// /// Created by John Sabins /// Application name: Slime fighter /// /// </summary> /// <param name="args"></param> static void Main(string[] args) { int windowHeight = 55; int windowWidth = 133; Console.SetWindowSize(windowWidth, windowHeight); int playTheGame = 1; playTheGame = MainMenu(playTheGame); if (playTheGame == 1) { Slime slime = new Slime(); Player player = new Player(); Ally ally = new Ally(); // programmer: John Sabins // Program: Slime Fighter Console.Clear(); ScreenWindows.DisplayTextboxMain(); Console.SetCursorPosition(38, 14); Console.CursorVisible = true; bool nameSet = false; string playername = "Bob"; while (!nameSet) { Console.Write("What is your name young slime fighter:"); playername = Console.ReadLine(); if (playername.Length < 1) { Console.SetCursorPosition(38, 15); Console.Write("Please enter a name... "); } else if (playername.Length >= 2) { nameSet = true; } Console.SetCursorPosition(38, 14); } Console.CursorVisible = false; #region intro Thread.Sleep(1000); Console.Clear(); ScreenWindows.DisplayTextboxMain(); Console.SetCursorPosition(38, 10); Console.WriteLine($"Welcome, {playername}"); Thread.Sleep(1000); Console.SetCursorPosition(38, 11); Console.WriteLine("to an endless cave that only has slimes."); Thread.Sleep(1000); Console.SetCursorPosition(38, 12); Console.WriteLine("Slimes are said to be one of the easiest enemies. "); Thread.Sleep(1000); Console.SetCursorPosition(38, 13); Console.WriteLine("Lets see if thats true."); Thread.Sleep(1000); Console.SetCursorPosition(38, 14); Console.WriteLine("Fight an onslaught of slimes to claim the Slime Crown."); Thread.Sleep(1000); Console.SetCursorPosition(38, 15); Console.WriteLine("A precious relic with immense healing capabilities."); Thread.Sleep(1000); #endregion ScreenWindows.DisplayContinuePrompt(90, 17); //----------------------Define player and attributes----------- InitializePlayer(player, playername); ScreenWindows.DisplayTextBoxPlayer(); Console.SetCursorPosition(27, 32); Console.Write("You enter the cave and start walking down an endless corridor"); Console.SetCursorPosition(27, 33); Console.Write("that you see no end to..."); Thread.Sleep(2000); playTheGame = GameLoop(player, slime, ally); } if (playTheGame == 2) { Console.SetCursorPosition(55, 16); Console.WriteLine("Thanks for playing"); Thread.Sleep(2500); } else if (playTheGame == 3) { ScreenWindows.DisplayTextboxMain(); Console.SetCursorPosition(59, 13); Console.Write("\\\\\\YOU WIN///"); Console.SetCursorPosition(55, 14); Console.WriteLine("Thank you for playing"); Console.ReadKey(); } }