added more balls
This commit is contained in:
33
web/game.js
33
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)) {
|
||||
|
Reference in New Issue
Block a user