-
Notifications
You must be signed in to change notification settings - Fork 0
/
Point.pde
49 lines (39 loc) · 861 Bytes
/
Point.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
public class Point {
int x;
int y;
boolean obstacle = false;
boolean start = false;
boolean end = false;
public Point(int x, int y) {
this.x = x;
this.y = y;
}
public void setObstacle() {
this.obstacle = !this.obstacle;
if (this.obstacle) {
square(x*100,y*100,width/10);
}
}
public void setStart(boolean start) {
this.start = start;
}
public void setEnd(boolean end) {
this.end = end;
}
public void output() {
System.out.println(x + ", " + y + "; is obstacle: " + obstacle);
}
public void draw() {
if (this.obstacle) {
fill(125);
square(x,y,width/10);
}
if (this.start) {
fill(0,255,0);
square(x,y,width/10);
}
if (this.end) {
fill(255,0,0);
square(x,y,width/10);
}
}}