-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTree.java
More file actions
30 lines (16 loc) · 769 Bytes
/
Tree.java
File metadata and controls
30 lines (16 loc) · 769 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import processing.core.PImage;
import java.util.List;
public class Tree extends Plant {
public Tree(String id, Point position, List<PImage> images, double animationPeriod, double actionPeriod, int health, int healthLimit) {
super(id, position, images, animationPeriod, actionPeriod, health, healthLimit);
}
public boolean transform(WorldModel world, EventScheduler scheduler, ImageStore imageStore) {
if (getHealth() <= 0) {
Stump stump = Factory.createStump(WorldLoader.STUMP_KEY + "_" + getId(), getPosition(), imageStore.getImageList(WorldLoader.STUMP_KEY));
world.removeEntity(scheduler, this);
world.tryAddEntity(stump);
return true;
}
return false;
}
}