-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathData.java
More file actions
112 lines (89 loc) · 1.99 KB
/
Data.java
File metadata and controls
112 lines (89 loc) · 1.99 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
/**
* Data
*
* This is the back end that holds all of the data for the game.
* Most classes have a object of this data class that can access the data through.
*
* @author Quinten Houck
* @version 8/1/2021
*
*/
public class Data {
private int count; //Current score or count//
private int lastX; //The X coordinate of the previous square//
private int lastY; //The Y coordinate of the previous square//
private int[][] grid; //A 10x10 integer grid//
Score score; //An object of the Score TextArea class//
boolean tutorial; //Whether the tutorial screen is active or not//
boolean tPage; //Whether the 2nd tutorial screen is active or not//
public Data() {
lastX = -1;
lastY = -1;
count = 0;
grid = new int[10][10];
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
grid[i][j] = 0;
}
}
score = new Score(this);
tutorial = false;
tPage = true;
}
//resets each grid square to 0//
public void reset() {
for (int i = 0; i < 10; i++) {
for (int j = 0; j < 10; j++) {
grid[i][j] = 0;
}
}
lastX = -1;
lastY = -1;
}
//Getters and Setters//
public Score getScore() {
return score;
}
public int getCount() {
return count;
}
public void setCount(int count) {
this.count = count;
}
public void addCount() {
count++;
}
public void subCount() {
count--;
}
public int getLastX() {
return lastX;
}
public void setLastX(int lastX) {
this.lastX = lastX;
}
public int getLastY() {
return lastY;
}
public void setLastY(int lastY) {
this.lastY = lastY;
}
public int[][] getGrid(){
return grid;
}
public void setGrid(int[][] grid) {
this.grid = grid;
}
public void setTutorial(boolean set) {
tutorial = set;
}
public boolean getTutorial() {
return tutorial;
}
public boolean gettPage() {
return tPage;
}
public void settPage(boolean tPage) {
this.tPage = tPage;
}
}