-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gui.cs
45 lines (38 loc) · 1.37 KB
/
Gui.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
using System.IO;
namespace MonsterGame
{
static class Gui
{
public static (int width, int height) MapDimensions {get; set;}
public static void DrawStats(int playerLives, int currentLevel) {
Console.SetCursorPosition(MapDimensions.width + 3, 1);
Console.WriteLine($"Player lives: {playerLives}");
Console.SetCursorPosition(MapDimensions.width + 3, 3);
Console.WriteLine($"Current Level: {currentLevel}");
}
public static void Intro() {
Console.WriteLine("press any key to start...");
Console.ReadKey();
}
public static bool PlayAgain() {
while (true) {
Console.Write("Play again [y/n]: ");
string answer = Console.ReadLine();
if (answer == "y") return true;
else if (answer == "n") return false;
else Console.WriteLine("Not a valid input!");
}
}
public static void GameOver() {
Console.Clear();
System.Console.WriteLine("Game Over!");
}
public static void GameCompleted(int currentLevel) {
Console.Clear();
Console.WriteLine("You won!");
Console.WriteLine($"continue to level {currentLevel}...");
Console.ReadKey();
}
}
}