-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathWave.java
More file actions
54 lines (47 loc) · 1.15 KB
/
Copy pathWave.java
File metadata and controls
54 lines (47 loc) · 1.15 KB
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
import java.util.*;
public class Wave {
private int waveNumber;
private ArrayList<Enemy> waveOfEnemy;
public Wave() {
this.waveNumber = 1;
this.waveOfEnemy = new ArrayList<Enemy>();
}
public void addEnemies() {
int current = 800;
for (int count = 0; count <= waveNumber * 5; count++) {
this.waveOfEnemy.add(new Regular(new Point(850, current)));
current += 50;
}
}
public boolean waveOver() {
if (this.waveOfEnemy.isEmpty()) {
this.waveNumber += 1;
return true;
}
return false;
}
public void nuke() {
for (int n = 0; n < this.waveOfEnemy.size(); n++) {
Regular x = (Regular) this.waveOfEnemy.get(n);
x.current_health = x.current_health / 2;
}
}
public int moveEnemies() {
int damage = 0;
for (int n = 0; n < this.waveOfEnemy.size(); n++) {
Enemy en = this.waveOfEnemy.get(n);
en.move();
if (en.getX() <= 400) {
damage += en.current_health;
this.waveOfEnemy.remove(en);
}
}
return damage;
}
public ArrayList<Enemy> getList() {
return this.waveOfEnemy;
}
public String waveNumber() {
return "Wave: " + this.waveNumber;
}
}