This commit is contained in:
Mees Roelofsz
2023-11-30 23:31:54 +01:00
parent 6543d6fdc9
commit 0d7f47c058

View File

@@ -54,7 +54,7 @@ function setup() {
function score() {
time += 1 / framerate;
time += 1 / framerate;
}
function life() {
@@ -192,7 +192,7 @@ function draw() {
}
}
function randomAttackPattern(){
function randomAttackPattern() {
if (shot == false || hit == true) {
spawnRandomBullet()
@@ -202,49 +202,49 @@ function randomAttackPattern(){
}
}
function spawnRandomBullet(){
function spawnRandomBullet() {
let patern = random([1,2,3]);
if (patern == 1) {
nextAttack = random([1, 2, 3, 4]);
text(nextAttack, 30, 50);
if (nextAttack == 1) {
shotPosX = 500;
shotPosY = 100;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
}
if (nextAttack == 2) {
shotPosX = random(0, 1000);
shotPosY = 600;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
}
if (nextAttack == 3) {
shotPosX = 0;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
}
if (nextAttack == 4) {
shotPosX = 1000;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
let patern = random([1, 2, 3]);
if (patern == 1) {
nextAttack = random([1, 2, 3, 4]);
text(nextAttack, 30, 50);
if (nextAttack == 1) {
shotPosX = 500;
shotPosY = 100;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 2) {
shotPosX = random(0, 1000);
shotPosY = 600;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 3) {
shotPosX = 0;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (nextAttack == 4) {
shotPosX = 1000;
shotPosY = random(0, 600);
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
}
if (patern == 2) {
shotPosX = bounceX;
shotPosY = bounceY;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
}
if (patern == 3) {
shotPosX = 500;
shotPosY = 100;
angle = 0;
// changing the angle of the bullets
for (let i = 0; i < 86; i++) {
bullets.push(new bullet(0, 100, radius, shotSpeed, shotPosX, shotPosY, hasMoved, angle));
angle -= 360 / 3;
}
}
}
if (patern == 2) {
shotPosX = bounceX;
shotPosY = bounceY;
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
}
if (patern == 3) {
shotPosX = 500;
shotPosY = 100;
angle = 0;
// changing the angle of the bullets
for (let i = 0; i < 86; i++) {
bullets.push(new bullet(0, 100, radius, shotSpeed, shotPosX, shotPosY, hasMoved, angle));
angle -= 360 / 3;
}
}
}
}