-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathBomb.java
59 lines (49 loc) · 1.64 KB
/
Bomb.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
package bomberman;
/**
* The class defines the methods and parameters needed for the bombs in the game. The constructor needs row-
* and column-indexes to define their place on the floor, as well as the explosionRadius which decides how
* many squares the explosion will cover. A few constants that defines the size and countdown of the bombs,
* and getters/setters are included in the class.
*/
public class Bomb
{
// Constants are static by definition.
private final static int BOMBSIZE = 30;
private final static int STARTCOUNTDOWN = 100;
private int timeToExplosion = STARTCOUNTDOWN;
private final int rowIndex;
private final int colIndex;
private int explosionRadius;
private boolean playerLeft;
public Bomb(final int rowIndex, final int colIndex, int explosionRadius) {
this.rowIndex = rowIndex;
this.colIndex = colIndex;
this.explosionRadius = explosionRadius;
playerLeft = false;
}
public int getRowIndex() {
return rowIndex;
}
public int getColIndex() {
return colIndex;
}
// This method is static since every bomb has the same size.
public static int getBOMBSIZE() {
return BOMBSIZE;
}
public int getTimeToExplosion() {
return timeToExplosion;
}
public void setTimeToExplosion(final int timeToExplosion) {
this.timeToExplosion = timeToExplosion;
}
public int getExplosionRadius() {
return explosionRadius;
}
public boolean isPlayerLeft() {
return playerLeft;
}
public void setPlayerLeft(final boolean playerLeft) {
this.playerLeft = playerLeft;
}
}