-
Notifications
You must be signed in to change notification settings - Fork 1
/
Substage.java
34 lines (28 loc) · 969 Bytes
/
Substage.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
package ast;
import ui.Goal;
import java.util.List;
/**
* A substage is entered through a level, and can have special behaviour to modify how the score is handled.
*/
public class Substage extends Stage {
private final Score score;
public Substage(Integer id, Speed speed, List<Integer> wallIDs, List<Integer> fireballIDs, Score score) {
super(id, speed, wallIDs, fireballIDs);
this.score = score;
}
public Score getScore() {
return score;
}
@Override
public void populateGoal(Game game) {
this.renderableObjects.add(new Goal(game.getWidth(), true));
}
/**
* We need to populate the objects again because a substage can be reused across multiple levels
*/
public Substage copy(Program program) {
Substage substage = new Substage(getId(), getSpeed(), getWallIDs(), getFireballIDs(), getScore());
substage.populateObjects(program);
return substage;
}
}