From 2cab4f6907dab64d6a49e8005c080044bb7d4921 Mon Sep 17 00:00:00 2001 From: Mees Roelofsz Date: Mon, 4 Dec 2023 22:55:39 +0100 Subject: [PATCH] added more balls --- web/game.js | 33 +++++++++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/web/game.js b/web/game.js index 87ebbe6..986aa81 100644 --- a/web/game.js +++ b/web/game.js @@ -43,6 +43,12 @@ let suroundX = 300; let suroundY = 300; let x2; let y2; +let x3; +let y3; +let x4; +let y4; +let x5; +let y5; //let myBullet = new bullet(); @@ -156,7 +162,15 @@ function draw() { let cosY = cos(suroundY); x2 = map(sinX, -1, 1, playerPosX - 200, playerPosX + 200); y2 = map(cosY, -1, 1, playerPosY - 200, playerPosY + 200); - //circle(x2, y2, 50); + x3 = map(-sinX, -1, 1, playerPosX - 200, playerPosX + 200); + y3 = map(-cosY, -1, 1, playerPosY - 200, playerPosY + 200); + x4 = map(sinX, -1, 1, playerPosX - 100, playerPosX + 100); + y4 = map(cosY, -1, 1, playerPosY - 100, playerPosY + 100); + x5 = map(-sinX, -1, 1, playerPosX - 100, playerPosX + 100); + y5 = map(-cosY, -1, 1, playerPosY - 100, playerPosY + 100); + circle(x3, y3, 50); + circle(x4, y4, 50); + circle(x5, y5, 50); } else { x2 = bossPosX; y2 = bossPosY; @@ -214,9 +228,20 @@ function spawnRandomBullet() { } } if (patern == 2) { - - shotPosX = x2; - shotPosY = y2; + let suroundChoice = random([1, 2, 3, 4]); + if (suroundChoice == 1) { + shotPosX = x2; + shotPosY = y2; + } if (suroundChoice == 2) { + shotPosX = x3; + shotPosY = y3; + } if (suroundChoice == 3) { + shotPosX = x4; + shotPosY = y4; + } if (suroundChoice == 4) { + shotPosX = x5; + shotPosY = y5; + } bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0)); } if (!(patern == 2)) {