-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwaves.js
85 lines (71 loc) · 4.01 KB
/
waves.js
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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
export class Waves {
constructor(game){
this.game = game;
this.wave = 1;
this.waves = [];
this.currentWave = undefined;
this.addWaves();
}
addWave(enemyCount, healthBonus, enemyTypes, enemyInterval, enemyShootIntervalBuff, enemyDamageBuff, enemyHealthBuff, enemySpeedBuff){
this.waves.push(new Wave(enemyCount, healthBonus, enemyTypes, enemyInterval, enemyShootIntervalBuff, enemyDamageBuff, enemyHealthBuff, enemySpeedBuff))
}
addWaves(){
// Pink Wave
//this.addWave(1, 50, ["pinkBoss"], 1000, 1, 1, 1, 1);
this.addWave(5, 25, ["pink"], 3000, 1, 1, 1, 1);
this.addWave(10, 25, ["pink", "pinkTurbo"], 3000, 1, 1, 1, 1);
this.addWave(15, 25, ["pink", "pinkTurbo"], 3000, 1, 1, 1, 1);
this.addWave(15, 25, ["pink", "pinkTurbo", "blue"], 3000, 1, 1, 1, 1);
this.addWave(15, 50, ["pink", "pinkTurbo", "blue"], 3000, 1, 1, 1, 1);
this.addWave(1, 50, ["pinkBoss"], 5000, 1, 1, 1, 1);
// Blue Wave
this.addWave(15, 25, ["blue"], 2900, 1, 1, 1, 1);
this.addWave(15, 25, ["blue", "blueTurbo", "pinkTurbo"], 2900, 1, 1, 1, 1);
this.addWave(15, 25, ["blue", "blueTurbo", "yellow", "pinkTurbo"], 2900, 1, 1, 1, 1);
this.addWave(15, 25, ["blue", "blueTurbo", "yellow", "yellowTurbo"], 2900, 1, 1, 1, 1);
this.addWave(15, 50, ["yellowTurbo", "yellow", "blue", "blueTurbo", "pinkTurbo"], 2900, 1, 1, 1, 1);
this.addWave(1, 50, ["blueBoss"], 5000, 1, 1, 1, 1);
// Yellow Wave
this.addWave(15, 25, ["yellow", "yellowTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["yellow", "yellowTurbo", "blueTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["yellow", "yellowTurbo", "purple", "blue", "blueTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["yellow", "yellowTurbo", "green", "blueTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 50, ["yellowTurbo", "green", "yellow", "purpleTurbo"], 2800, 1, 1, 1, 1);
this.addWave(1, 50, ["yellowBoss"], 5000, 1, 1, 1, 1);
// Green Wave
this.addWave(15, 25, ["green", "greenTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["green", "greenTurbo", "purpleTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["green", "greenTurbo", "purple", "yellow", "purpleTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 25, ["green", "greenTurbo", "purple", "purpleTurbo"], 2800, 1, 1, 1, 1);
this.addWave(15, 50, ["greenTurbo", "yellowTurbo", "blueTurbo", "purpleTurbo", "pinkTurbo"], 2800, 1, 1, 1, 1);
this.addWave(1, 50, ["greenBoss"], 1000, 1, 1, 1, 1);
}
update(){
if (this.wave > this.waves.length){
this.game.wonGame = true;
} else if (this.game.lives > 0) {
this.currentWave = this.waves[this.wave-1];
this.game.wave = this.wave;
this.game.waveAmount = this.currentWave.enemyCount;
this.game.spawnInterval = this.currentWave.enemyInterval;
this.game.enemyTypes = this.currentWave.enemyTypes;
this.game.enemyShootIntervalBuff = this.currentWave.enemyShootIntervalBuff;
this.game.enemyDamageBuff = this.currentWave.enemyDamageBuff;
this.game.enemyHealthBuff = this.currentWave.enemyHealthBuff;
this.game.enemySpeedBuff = this.currentWave.enemySpeedBuff;
}
}
}
class Wave {
constructor(enemyCount, healthBonus, enemyTypes, enemyInterval, enemyShootIntervalBuff, enemyDamageBuff, enemyHealthBuff, enemySpeedBuff){
this.enemyCount = enemyCount;
this.healthBonus = healthBonus;
this.enemyTypes = enemyTypes;
this.enemyInterval = enemyInterval;
this.enemyShootIntervalBuff = enemyShootIntervalBuff;
this.enemyDamageBuff = enemyDamageBuff;
this.enemyHealthBuff = enemyHealthBuff;
this.enemySpeedBuff = enemySpeedBuff;
//console.log(this.enemyHealthBuff)
}
}