-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFloor.pde
33 lines (29 loc) · 1020 Bytes
/
Floor.pde
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
enum FloorType {
GRASS, INDOOR, PATH;
}
// The floor class is used to tile the room and make the concept of a floor
public class Floor extends GameObject{
float width, height;
PImage imageType;
FloorType floorType;
public Floor(float x, float y, float width, float height, FloorType floorType) {
super(x, y, ((Shape) new Rectangle2D.Float(x, y, width, height)));
this.width = width;
this.height = height;
this.floorType = floorType;
findImageType();
}
public void draw() {
image(this.imageType, this.getX(), this.getY(), this.width, this.height);
}
// Determine what type of floor tile should be displayed
private void findImageType() {
if(this.floorType == FloorType.GRASS) {
this.imageType = GRASS;
} else if(this.floorType == FloorType.INDOOR) {
this.imageType = INDOOR_FLOOR;
} else if(this.floorType == FloorType.PATH) {
this.imageType = PATH;
}
}
}