-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
62 lines (52 loc) · 1.03 KB
/
main.cpp
File metadata and controls
62 lines (52 loc) · 1.03 KB
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
#include <iostream>
#include "Game.h"
#include "Interface.h"
using namespace std;
int main() {
cout << "\033[H\033[J";
Game game = Game();
while(game.getPlayer()->getHealth()>0){
Level* l = game.getCurrentLevel();
Interface* i = game.getInterface();
Player* p = game.getPlayer();
cout << "\033[H\033[J";
if(l->playerIsOnEnemy()!=nullptr){
i->fight(*p,*l->playerIsOnEnemy(),*l);
}
l->printLevel();
l->checkForDead();
l->moveEnemies();
int d = game.getInterface()->promptMoveLoop();
string dir = "up";
if(d==SOUTH){
dir = "down";
}
if(d==EAST){
dir = "right";
}
if(d==WEST){
dir = "left";
}
if(d==-1){
cout << "you quit the game"<< endl;
break;
}
l->movePlayer(dir);
}
return 0;
}
int old() {
Question q = Question();
q.setPrompt("Q1");
q.setIsMcq(true);
q.addAnswer("a",true);
q.addAnswer("b",false);
Interface test = Interface();
test.ask(q,1);
Player p = Player();
Enemy e = Enemy(100,1,0,0);
Level l(p,0);
test.fight(p,e,l);
cout << "Running" << endl;
return 0;
}