-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCharacter.pde
56 lines (49 loc) · 1.52 KB
/
Character.pde
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
class Character {
NodesBase nodesBase;
Shape[][] interactShape;
Shape[][] normalShape;
int baseWidth, baseHeight;
Character(NodesBase nodesBase) {
this.nodesBase = nodesBase;
baseWidth = this.nodesBase.xAxisNodeNum;
baseHeight = this.nodesBase.yAxisNodeNum;
}
Boolean isShapeUnbounded(int[] location, int[] scope) {
boolean isUnbounded = false;
if (location[0] + scope[0] > nodesBase.xAxisNodeNum - 1) {
isUnbounded = true;
}
if (location[1] + scope[1] > nodesBase.yAxisNodeNum - 1) {
isUnbounded = true;
}
return isUnbounded;
}
void displayInteractShape() {
if (interactShape != null) {
for (int x=0; x<interactShape.length; x++) {
for (int y=0; y<interactShape[x].length; y++) {
interactShape[x][y].display();
}
}
}
}
void displayNormalShape() {
if (normalShape != null) {
for (int x=0; x<normalShape.length; x++) {
for (int y=0; y<normalShape[x].length; y++) {
normalShape[x][y].display();
}
}
}
}
void displayAllShapes() {
displayInteractShape();
displayNormalShape();
}
void triggerInteractShape(int x, int y) {
interactShape[x][y].trigger();
}
void triggerNormalShape(int x, int y) {
normalShape[x][y].trigger();
}
}