-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMaze.pde
49 lines (48 loc) · 1.05 KB
/
Maze.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
class Maze {
float space;
float rows;
float cols;
Maze() {
space=40;
rows=640/space;
cols=640/space;
}
void render() {
noStroke();
// pushMatrix();
// popMatrix();
int x=0;
for (int j=0; j<rows; j++) {
for (int i=0; i<=cols; i++) {
walls[x].change(i*space, j*space, i*space, (j+1)*space);
x++;
}
}
for (int j=0; j<cols; j++) {
for (int i=0; i<=rows; i++) {
walls[x].change(j*space, i*space, (j+1)*space, i*space);
x++;
}
}
for (int i=0; i<544; i++) {
if (walls[i].show!=false)
walls[i].render();
}
}
void update() {
if (mousePressed==true) {
for (int i=0; i<544; i++) {
if (mouseY>walls[i].y1&&mouseY<walls[i].y2) {
if (mouseX>walls[i].x1-6&&mouseX<walls[i].x1+6) {
walls[i].show=false;
}
}
if (mouseX>walls[i].x1&&mouseX<walls[i].x2) {
if (mouseY>walls[i].y1-6&&mouseY<walls[i].y1+6) {
walls[i].show=false;
}
}
}
}
}
}