added singular wave to phase 1
This commit is contained in:
50
web/game.js
50
web/game.js
@@ -58,6 +58,12 @@ let nextWave = [];
|
|||||||
let iIndex = 0;
|
let iIndex = 0;
|
||||||
|
|
||||||
let bulletAmount = 5;
|
let bulletAmount = 5;
|
||||||
|
|
||||||
|
let phase1 = false;
|
||||||
|
let phase2 = false;
|
||||||
|
let phase3 = false;
|
||||||
|
let phase4 = false;
|
||||||
|
let phase5 = false;
|
||||||
//let myBullet = new bullet();
|
//let myBullet = new bullet();
|
||||||
// the function setup() is called once when the page is loaded
|
// the function setup() is called once when the page is loaded
|
||||||
function setup() {
|
function setup() {
|
||||||
@@ -262,7 +268,10 @@ async function randPatern() {
|
|||||||
chosen = false;
|
chosen = false;
|
||||||
}
|
}
|
||||||
if (patern == 5) {
|
if (patern == 5) {
|
||||||
await wait(30000);
|
if (phase1 == true) {
|
||||||
|
nextWave = random([1, 2, 3, 4]);
|
||||||
|
}
|
||||||
|
await wait(3000);
|
||||||
chosen = false;
|
chosen = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -278,8 +287,9 @@ function randomAttackPattern() {
|
|||||||
|
|
||||||
function phase() {
|
function phase() {
|
||||||
switch (true) {
|
switch (true) {
|
||||||
case (time < 10):
|
case (time < 20):
|
||||||
paternArray = [1]
|
phase1 = true;
|
||||||
|
paternArray = [1,5];
|
||||||
push();
|
push();
|
||||||
fill(255, 0, 255);
|
fill(255, 0, 255);
|
||||||
textSize(10);
|
textSize(10);
|
||||||
@@ -288,7 +298,9 @@ function phase() {
|
|||||||
pop();
|
pop();
|
||||||
break;
|
break;
|
||||||
case (time < 60):
|
case (time < 60):
|
||||||
paternArray = [2, 5]
|
paternArray = [5];
|
||||||
|
phase1 = false;
|
||||||
|
phase2 = true;
|
||||||
push();
|
push();
|
||||||
fill(255, 0, 255);
|
fill(255, 0, 255);
|
||||||
textSize(10);
|
textSize(10);
|
||||||
@@ -297,7 +309,9 @@ function phase() {
|
|||||||
pop();
|
pop();
|
||||||
break;
|
break;
|
||||||
case (time < 90):
|
case (time < 90):
|
||||||
paternArray = [3, 4]
|
phase2 = false;
|
||||||
|
phase3 = true;
|
||||||
|
paternArray = [2];
|
||||||
push();
|
push();
|
||||||
fill(255, 0, 255);
|
fill(255, 0, 255);
|
||||||
textSize(10);
|
textSize(10);
|
||||||
@@ -305,9 +319,10 @@ function phase() {
|
|||||||
text("phase 3", 10, 50);
|
text("phase 3", 10, 50);
|
||||||
pop();
|
pop();
|
||||||
break;
|
break;
|
||||||
case (time >= 90):
|
case (time < 120):
|
||||||
finalPhase = true;
|
phase3 = false;
|
||||||
paternArray = [1, 2, 3, 4, 5]
|
phase4 = true;
|
||||||
|
paternArray = [3, 4];
|
||||||
push();
|
push();
|
||||||
fill(255, 0, 255);
|
fill(255, 0, 255);
|
||||||
textSize(10);
|
textSize(10);
|
||||||
@@ -315,6 +330,18 @@ function phase() {
|
|||||||
text("phase 4", 10, 50);
|
text("phase 4", 10, 50);
|
||||||
pop();
|
pop();
|
||||||
break;
|
break;
|
||||||
|
case (time >= 120):
|
||||||
|
phase4 = false;
|
||||||
|
phase5 = false;
|
||||||
|
finalPhase = true;
|
||||||
|
paternArray = [1, 2, 3, 4, 5];
|
||||||
|
push();
|
||||||
|
fill(255, 0, 255);
|
||||||
|
textSize(10);
|
||||||
|
textAlign(LEFT);
|
||||||
|
text("phase 5", 10, 50);
|
||||||
|
pop();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -398,8 +425,10 @@ function spawnRandomBullet() {
|
|||||||
angle = 0;
|
angle = 0;
|
||||||
}
|
}
|
||||||
if (patern == 5) {
|
if (patern == 5) {
|
||||||
|
if (phase1 == false) {
|
||||||
nextWave = random([1, 2, 3, 4]);
|
nextWave = random([1, 2, 3, 4]);
|
||||||
bulletAmount = 15;
|
bulletAmount = 10;
|
||||||
|
}
|
||||||
if (nextWave == 1) {
|
if (nextWave == 1) {
|
||||||
for (let i = 0; i < random(8, 15); i++) {
|
for (let i = 0; i < random(8, 15); i++) {
|
||||||
let shotWidth = random(0, width);
|
let shotWidth = random(0, width);
|
||||||
@@ -435,9 +464,6 @@ function spawnRandomBullet() {
|
|||||||
|
|
||||||
} else {
|
} else {
|
||||||
bulletAmount = 5;
|
bulletAmount = 5;
|
||||||
if (finalPhase == true) {
|
|
||||||
bulletAmount = 10;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user