-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGamesystem.cpp
81 lines (60 loc) · 1.58 KB
/
Gamesystem.cpp
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include "Gamesystem.h"
#include <ctime>
//Constructor sets up the game
Gamesystem::Gamesystem(string levelFileName) {
_level.load(levelFileName, _player);
_level.print(_player);
}
void Gamesystem::playGame() {
cout << "\n\n\t\t OH hek. U lost ur dragon (D) find him to excape this maze. \n\t\t Be vary theres nasty monsteros lurking that follow you.\n\t\t If you dare come close \n\n";
system("pause");
string pname;
cout << "\t\t What is your nickname, adventurer: ";
cin >> pname;
_player.setPName(pname);
setDifficulty();
bool isDone = false;
while (endGame() == false) {
_level.print(_player);
playerMove();
_level.updateEnemies(_player);
}
HScores HighScores;
HighScores.orderHScores(_player);
}
void Gamesystem::playerMove() {
char input;
cout << "\n\n\n" << setw(30) << " Enter a move command (w/a/s/d): ";
input = _getch();
_level.movePlayer(input, _player);
}
bool Gamesystem::endGame() {
return _level.endGame;
}
void Gamesystem::setDifficulty() {
string difficulty;
bool valid = false;
while (!valid) {
printf("\n\t\tWhat difficulty do you require?: (HARD/MEDIUM/EASY): ");
cin >> difficulty;
cout << endl;
if (difficulty == "HARD" || difficulty == "hard") {
_player.setfov(3);
valid = true;
}
else if (difficulty == "MEDIUM" || difficulty == "medium") {
_player.setfov(7);
valid = true;
}
else if (difficulty == "EASY" || difficulty == "easy") {
_player.setfov(10);
valid = true;
}
else {
printf("\n\t\tPlease enter appropriate difficulty. \n");
}
}
}
Player Gamesystem::getPlayer() {
return _player;
}