-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cpp
More file actions
56 lines (48 loc) · 1.23 KB
/
Copy pathmain.cpp
File metadata and controls
56 lines (48 loc) · 1.23 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
#include <iostream>
#include <chrono>
#include "rlutil.h"
#include "Player.h"
#include "Enemy.h"
#include "World.h"
//char key() {
// time_t start = time(NULL);
// while (!kbhit()) {
// if (time(NULL) - start >= 0.3)
// return -1;
// }
// return getch();
//}
int main() {
Player p1;
Player p2(2,3,'%'),p3(p1);
p3=p2;
p2.move(-1,0);
p2.move(0,1);
std::cout<<"p2: "<<p2<<"p3: "<<p3;
Enemy e1;
Enemy e2(5,4,'^');
Enemy e3(e1);
std::cout<<"e2: "<<e2<<"e3: "<<e3;
try {
char icon;
bool playing=true;
std::cout << "select (by pressing) the character for your player icon...";
icon = getch();
std::cout << "\n\nyou selected: " << icon;
rlutil::anykey("\n\npress e to continue\n\n");
while(playing) {
World world((char) icon);
rlutil::cls();
world.play();
std::cout<<" press Q to quit\n"
<<" press any other key to try again...\n";
if(getch() == 'q'){
playing = false;
}
}
}
catch (NameError& err){
std::cout<< err.what();
}
return 0;
}