added off screen attacks from more sides

This commit is contained in:
Mees Roelofsz
2023-11-26 19:33:01 +01:00
parent 406a044585
commit 587454784b

View File

@@ -13,7 +13,7 @@ let booleanArray = window.booleanArray;
let lives = 2;
let shotSpeed = 5;
let shotSpeed = 9;
let projectile;
let projSize = 5;
let shot;
@@ -154,7 +154,8 @@ function draw() {
text(time, 10, 20);
if (shot == false || hit == true) {
nextAttack = random(1, 2);
nextAttack = random([1,2,3,4]);
text(nextAttack, 30, 50);
if (nextAttack == 1) {
shotPosX = 500;
shotPosY = 100;
@@ -165,6 +166,16 @@ function draw() {
shotPosY = 600;
shoot(playerPosX, playerPosY);
}
if (nextAttack == 3) {
shotPosX = 0;
shotPosY = random(0, 600);
shoot(playerPosX, playerPosY);
}
if (nextAttack == 4) {
shotPosX = 1000;
shotPosY = random(0, 600);
shoot(playerPosX, playerPosY);
}
}
}