-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathClientData.java~
50 lines (32 loc) · 1.12 KB
/
ClientData.java~
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
// client side version of game data; only stuff that's relevant to client's PC
import java.util.Scanner;
public class ClientData {
// ********* this is a WAY simplified version ************
private int xCoord;
private int yCoord; //coords of character's middle
private char[][] points;
public ClientData() {
xCoord=-1;
yCoord=-1;
points = new char[GameData.CLIENT_VISION_DIAMETER][GameData.CLIENT_VISION_DIAMETER];
} //empty constructor
public ClientData(String encoding) {
// ***** WAYYYY simplified *********
points = new char[GameData.CLIENT_VISION_DIAMETER][GameData.CLIENT_VISION_DIAMETER];
for (int y = 0; y < GameData.CLIENT_VISION_DIAMETER; y++) {
for (int x = 0; x < GameData.CLIENT_VISION_DIAMETER; x++) {
points[x][y] = encoding.charAt(y*GameData.CLIENT_VISION_DIAMETER + x);
}
}
} //real constructor
////////////// ACCESSORS /////////////////
public int getXCoord() {
return xCoord;
} //getXCoord
public int getYCoord() {
return yCoord;
} //getYCoord
public char getPoint(int x, int y) {
return points[x][y];
} //getPoint
} //class