-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathIBlock.java
30 lines (27 loc) · 909 Bytes
/
IBlock.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
import java.awt.*;
import java.util.HashSet;
import java.util.Set;
public class IBlock extends Block {
public IBlock(Point generatePoint) {
super(generatePoint);
this.points = getPointByState(0);
}
@Override
public Set<Point> getPointByState(int state) {
int x = benchmark.x;
int y = benchmark.y;
Set<Point> points = new HashSet<>();
if (state == 0 || state == 2) {
points.add(new Point(x, y));
points.add(new Point(x, y - BLOCK_SIZE));
points.add(new Point(x, y - BLOCK_SIZE * 2));
points.add(new Point(x, y - BLOCK_SIZE * 3));
} else {
points.add(new Point(x - BLOCK_SIZE, y));
points.add(new Point(x, y));
points.add(new Point(x + BLOCK_SIZE, y));
points.add(new Point(x + BLOCK_SIZE * 2, y));
}
return points;
}
}