-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShape.java
58 lines (48 loc) · 1.09 KB
/
Shape.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
package lab12;
import java.awt.Color;
public abstract class Shape implements Anim{
// Coordinates of shape
protected double x, y;
// Color of shape
protected Color color;
/**
* Move left
*/
public abstract void left();
/**
* Move right
*/
public abstract void right();
/**
* Check collisions at Y direction: down.
* @param bg
* @return true if there is any collision.
*/
public abstract boolean checkCollisionY(background bg);
/**
* Check collisions at X direction: left or right.
* @param bg the background that contains information of cells the board.
* @return true if there is any collision.
*/
public abstract boolean checkCollisionX(background bg, boolean left);
/**
* Add the shape onto the background.
* @param bg the background that contains information of cells the board.
*/
public abstract void addToBackground(background bg);
public double getX(){
return x;
}
public double getY(){
return y;
}
public void setX(double v){
this.x = v;;
}
public void setY(double v){
this.y = v;
}
public Color getColor(){
return color;
}
}