added nextwave variable
This commit is contained in:
11
web/game.js
11
web/game.js
@@ -48,6 +48,7 @@ let y5;
|
||||
let homescreenOn = true;
|
||||
let chosen = false;
|
||||
let finalPhase = false;
|
||||
let nextWave = [];
|
||||
|
||||
let bulletAmount = 5;
|
||||
//let myBullet = new bullet();
|
||||
@@ -316,9 +317,9 @@ function spawnRandomBullet() {
|
||||
angle = 0;
|
||||
}
|
||||
if (patern == 5) {
|
||||
let nextAttack = random([1, 2, 3, 4]);
|
||||
nextWave = random([1, 2, 3, 4]);
|
||||
bulletAmount = 15;
|
||||
if (nextAttack == 1) {
|
||||
if (nextWave == 1) {
|
||||
for (let i = 0; i < random(8, 15); i++) {
|
||||
let shotWidth = random(0, width);
|
||||
shotPosX = shotWidth;
|
||||
@@ -326,7 +327,7 @@ function spawnRandomBullet() {
|
||||
bullets.push(new bullet(shotWidth, 0, radius, shotSpeed / 5, shotPosX, shotPosY, hasMoved, angle));
|
||||
}
|
||||
}
|
||||
if (nextAttack == 2) {
|
||||
if (nextWave == 2) {
|
||||
for (let i = 0; i < random(8, 10); i++) {
|
||||
let shotWidth = random(0, width);
|
||||
shotPosX = shotWidth;
|
||||
@@ -334,7 +335,7 @@ function spawnRandomBullet() {
|
||||
bullets.push(new bullet(shotWidth, height, radius, shotSpeed / 5, shotPosX, shotPosY, hasMoved, angle));
|
||||
}
|
||||
}
|
||||
if (nextAttack == 3) {
|
||||
if (nextWave == 3) {
|
||||
for (let i = 0; i < random(8, 10); i++) {
|
||||
let shotHeight = random(0, width);
|
||||
shotPosX = 0;
|
||||
@@ -342,7 +343,7 @@ function spawnRandomBullet() {
|
||||
bullets.push(new bullet(width, shotHeight, radius, shotSpeed / 5, shotPosX, shotPosY, hasMoved, angle));
|
||||
}
|
||||
}
|
||||
if (nextAttack == 4) {
|
||||
if (nextWave == 4) {
|
||||
for (let i = 0; i < random(8, 10); i++) {
|
||||
let shotHeight = random(0, width);
|
||||
shotPosX = width;
|
||||
|
Reference in New Issue
Block a user