-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObstacle.java
More file actions
30 lines (24 loc) · 738 Bytes
/
Obstacle.java
File metadata and controls
30 lines (24 loc) · 738 Bytes
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.*;
public class Obstacle extends GameObject{
private String shape;
private boolean permeable;
private Rectangle hitbox;
Obstacle(String shape, int x, int y, int width, int height, boolean permeable){
super.setX(x);
super.setY(y);
super.setWidth(width);
super.setHeight(height);
this.shape = shape;
this.permeable = permeable;
this.hitbox = new Rectangle(super.getWidth(), super.getHeight(), super.getX(), super.getY());
}
public Rectangle getHitbox(){
return this.hitbox;
}
public boolean collides(GameObject other) {
return false;
}
public boolean getPermeable(){
return this.permeable;
}
}