-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathBaseGate.java
More file actions
37 lines (29 loc) · 746 Bytes
/
BaseGate.java
File metadata and controls
37 lines (29 loc) · 746 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
31
32
33
34
35
36
37
import greenfoot.Actor;
/**
* An object which blocks the way for the zombies to get into the survivors
* base. The player has to avoid that zombies attack it.
*/
public class BaseGate extends Actor {
private static final String GATE_IMAGE_NAME = "Gate.png";
private double durability = 300;
/**
* Creates an base gate object and sets its image.
*/
public BaseGate() {
setImage(GATE_IMAGE_NAME);
}
public double getDurability() {
return durability;
}
public void setDurability(double durability) {
this.durability = durability;
}
/**
* reduces its health by the amount of damage it gets
*
* @param damage the damage it absorbs
*/
public void absorbDamage(double damage) {
this.durability -= damage;
}
}