diff --git a/web/game.js b/web/game.js index f114d35..24f2cdd 100644 --- a/web/game.js +++ b/web/game.js @@ -25,7 +25,6 @@ let shotPosY; let initialPlayerPosX = playerPosX; let initialPlayerPosY = playerPosY; -let nextAttack; let bullets = []; let direction; let framerate = 120; @@ -48,7 +47,7 @@ let y5; let homescreenOn = false; let chosen = false; -let bulletAmount = 10; +let bulletAmount = 20; //let myBullet = new bullet(); // the function setup() is called once when the page is loaded function setup() { @@ -228,7 +227,7 @@ function draw() { } async function randPatern () { - patern = random([1,2]); + patern = random([5]); chosen = true; if (patern == 1) { await wait(3000); @@ -238,6 +237,10 @@ async function randPatern () { await wait(5000); chosen = false; } + if (patern == 5) { + await wait(30000); + chosen = false; + } } @@ -255,7 +258,7 @@ function spawnRandomBullet() { } if (patern == 1) { - nextAttack = random([1, 2, 3, 4, 5]); + let nextAttack = random([1, 2, 3, 4, 5]); //text(nextAttack, 30, 50); if (nextAttack == 1) { shotPosX = bossPosX; @@ -328,6 +331,42 @@ function spawnRandomBullet() { } angle = 0; } + if (patern == 5) { + let nextAttack = random([1, 2, 3]); + if (nextAttack == 1) { + for (let i = 0; i < random(3, 10); i++) { + let shotWidth = random(0, width); + shotPosX = shotWidth + shotPosY = height; + bullets.push(new bullet(shotWidth, 0, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle)); + } + } + if (nextAttack == 2) { + for (let i = 0; i < random(3, 10); i++) { + let shotWidth = random(0, width); + shotPosX = shotWidth + shotPosY = 0; + bullets.push(new bullet(shotWidth, height, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle)); + } + } + if (nextAttack == 3) { + for (let i = 0; i < random(3, 10); i++) { + let shotHeight = random(0, width); + shotPosX = 0 + shotPosY = shotHeight; + bullets.push(new bullet(width, shotHeight, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle)); + } + } + if (nextAttack == 3) { + for (let i = 0; i < random(3, 10); i++) { + let shotHeight = random(0, width); + shotPosX = width + shotPosY = shotHeight; + bullets.push(new bullet(0, shotHeight, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle)); + } + } + + } }