more bullets, score only after moving, attack dir

This commit is contained in:
Mees Roelofsz
2023-12-05 14:26:22 +01:00
parent 10a4aee3e0
commit f4ae1aa72b

View File

@@ -26,10 +26,6 @@ let initialPlayerPosX = playerPosX;
let initialPlayerPosY = playerPosY;
let nextAttack;
// let bounceX = bossPosX;
// let bounceY = bossPosY;
// let predictiveBounceX;
// let predictiveBounceY;
let bullets = [];
let direction;
let framerate = 120;
@@ -38,7 +34,7 @@ let time = 0;
let shotPoint = 0;
let angle = 0;
let patern = 2;
let patern;
let suroundX = 300;
let suroundY = 300;
let x2;
@@ -50,6 +46,8 @@ let y4;
let x5;
let y5;
let bulletAmount = 10;
//let myBullet = new bullet();
// the function setup() is called once when the page is loaded
@@ -149,8 +147,10 @@ function draw() {
// draw boss
fill(255, 165, 0)
circle(x2, y2, 50);
if (hasMoved == true) {
score();
}
score();
textAlign(LEFT);
text(int(time), 10, 20);
@@ -193,19 +193,18 @@ function draw() {
function randomAttackPattern() {
if (shot == false || hit == true) {
spawnRandomBullet()
spawnRandomBullet()
spawnRandomBullet()
spawnRandomBullet()
for (i = 0; i < bulletAmount; i++) {
spawnRandomBullet()
}
}
}
function spawnRandomBullet() {
//patern = random([2]);
patern = random([1,2]);
if (patern == 1) {
nextAttack = random([1, 2, 3, 4]);
text(nextAttack, 30, 50);
nextAttack = random([1, 2, 3, 4, 5]);
//text(nextAttack, 30, 50);
if (nextAttack == 1) {
shotPosX = bossPosX;
shotPosY = bossPosY;
@@ -213,19 +212,24 @@ function spawnRandomBullet() {
}
if (nextAttack == 2) {
shotPosX = random(0, 1000);
shotPosY = 610;
shotPosY = 600;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 3) {
shotPosX = -10;
shotPosX = 10;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 4) {
shotPosX = 1010;
shotPosX = 1000;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 5) {
shotPosX = random(0, 1000);
shotPosY = 0;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
}
if (patern == 2) {
let suroundChoice = random([1, 2, 3, 4]);