-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGame.java
More file actions
41 lines (31 loc) · 769 Bytes
/
Copy pathGame.java
File metadata and controls
41 lines (31 loc) · 769 Bytes
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
public class Game {
private Map m = null;
public Game(String filename, String keyfile) {
m = new Map(filename, keyfile);
}
public static void main(String[] args) {
Game g = new Game(args[0], args[1]);
g.play();
}
public void play() {
System.out.println("\033[2J");
try {
while(true) {
//Should we do this in the main method, or a play method?
//We need a game loop!
m.drawMap();
for(String m: Map.messages) {
System.out.println(m);
}
Map.messages.clear();
m.doAction();
}
} catch (QuitException e) {
try{Thread.sleep(5000);}catch(Exception e2){}
System.out.println(e.getMessage());
} catch (GameException e) {
System.out.println(e.getMessage());
e.printStackTrace();
}
}
}