-
Notifications
You must be signed in to change notification settings - Fork 3
/
TileAssemble.java
55 lines (49 loc) · 1.3 KB
/
TileAssemble.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
51
52
53
54
55
package aStarAlgorithm;
import java.awt.Color;
import java.awt.Graphics2D;
public abstract class TileAssemble {
public static class Empty extends TileObjectAbstract{
public Empty(){
super(false);
}
public void displayMyself(Graphics2D g2, int x, int y, int square) {
//do nothing
}
}
public static class Block extends TileObjectAbstract{
public Block(){
super(true);
}
public void displayMyself(Graphics2D g2, int x, int y, int square) {
g2.setColor(Color.GRAY);
g2.fillRect(x * square, y * square, square, square);
}
}
public static class Start extends TileObjectAbstract{
public Start(){
super(false);
}
public void displayMyself(Graphics2D g2, int x, int y, int square) {
g2.setColor(Color.GREEN);
g2.fillRect(x * square, y * square, square, square);
}
}
public static class Goal extends TileObjectAbstract{
public Goal(){
super(false);
}
public void displayMyself(Graphics2D g2, int x, int y, int square) {
g2.setColor(Color.RED);
g2.fillRect(x * square, y * square, square, square);
}
}
public static class Path extends TileObjectAbstract{
public Path(){
super(false);
}
public void displayMyself(Graphics2D g2, int x, int y, int square) {
g2.setColor(Color.BLUE);
g2.fillOval(x * square, y * square, square, square);
}
}
}