-
Notifications
You must be signed in to change notification settings - Fork 0
/
BreakoutFacade.java
71 lines (54 loc) · 1.89 KB
/
BreakoutFacade.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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
package breakout;
import java.awt.Color;
//No documentation required for this class
public class BreakoutFacade {
public PaddleState createNormalPaddleState(Point center) {
return new NormalPaddleState(center, PaddleState.DEFAULT_SIZE);
}
public Ball createNormalBall(Point center, int diameter, Vector initBallVelocity) {
return new NormalBall(center,diameter,initBallVelocity);
}
public Ball createSuperchargedBall(Point center, int diameter, Vector initBallVelocity, int lifetime) {
return new SuperBall(center,diameter,initBallVelocity,lifetime);
}
public BreakoutState createBreakoutState(Ball[] balls, BlockState[] blocks, Point bottomRight,
PaddleState paddle) {
return new BreakoutState(balls, blocks, bottomRight, paddle);
}
public BlockState createNormalBlockState(Point topLeft, Point bottomRight) {
return new NormalBlockState(topLeft, bottomRight);
}
public BlockState createSturdyBlockState(Point topLeft, Point bottomRight, int i) {
return new SturdyBlockState(topLeft, bottomRight, i);
}
public BlockState createReplicatorBlockState(Point topLeft, Point bottomRight) {
return new ReplicatorBlockState(topLeft, bottomRight);
}
public BlockState createPowerupBallBlockState(Point topLeft, Point bottomRight) {
return new PowerupBallBlockState(topLeft, bottomRight);
}
public Color getColor(PaddleState paddle) {
return paddle.getColor();
}
public Color getColor(Ball ball) {
return ball.getColor();
}
public Rect getLocation(PaddleState paddle) {
return paddle.rectangleOf();
}
public Point getCenter(Ball ball) {
return ball.getCenter();
}
public int getDiameter(Ball ball) {
return ball.getDiameter();
}
public Ball[] getBalls(BreakoutState breakoutState) {
return breakoutState.getBalls();
}
public Color getColor(BlockState block) {
return block.getColor();
}
public Rect getLocation(BlockState block) {
return block.rectangleOf();
}
}