Merge branch 'main' of https://gitlab.fdmci.hva.nl/propedeuse-hbo-ict/onderwijs/2023-2024/out-a-se-ti/blok-2/cuujooceevii61
This commit is contained in:
42
web/game.js
42
web/game.js
@@ -8,7 +8,7 @@ const playerSize = 10;
|
|||||||
let radius = playerSize / 2;
|
let radius = playerSize / 2;
|
||||||
let playerPosX = 500
|
let playerPosX = 500
|
||||||
let playerPosY = 300;
|
let playerPosY = 300;
|
||||||
let playerSpeed = 3;
|
let playerSpeed = 4;
|
||||||
let booleanArray = window.booleanArray;
|
let booleanArray = window.booleanArray;
|
||||||
let lives = 1;
|
let lives = 1;
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ function randomAttackPattern() {
|
|||||||
|
|
||||||
function spawnRandomBullet() {
|
function spawnRandomBullet() {
|
||||||
|
|
||||||
let patern = random([1, 2]);
|
let patern = random([1,2,3,4]);
|
||||||
if (patern == 1) {
|
if (patern == 1) {
|
||||||
nextAttack = random([1, 2, 3, 4]);
|
nextAttack = random([1, 2, 3, 4]);
|
||||||
text(nextAttack, 30, 50);
|
text(nextAttack, 30, 50);
|
||||||
@@ -240,16 +240,32 @@ function spawnRandomBullet() {
|
|||||||
shotPosY = bounceY;
|
shotPosY = bounceY;
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
|
||||||
}
|
}
|
||||||
// if (patern == 3) {
|
if (patern == 3) {
|
||||||
// shotPosX = 500;
|
shotPosX = 500;
|
||||||
// shotPosY = 100;
|
shotPosY = 100;
|
||||||
// angle = 0;
|
angle = 0;
|
||||||
// // changing the angle of the bullets
|
// changing the angle of the bullets
|
||||||
// for (let i = 0; i < 86; i++) {
|
for (let i = 0; i < 86; i++) {
|
||||||
// bullets.push(new bullet(0, 100, radius, shotSpeed, shotPosX, shotPosY, hasMoved, angle));
|
setTimeout(function() {
|
||||||
// angle -= 360 / 3;
|
bullets.push(new bullet(0, 100, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
// }
|
angle -= 360 / 3;
|
||||||
|
}, i * 100);
|
||||||
// }
|
}
|
||||||
|
angle = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
if (patern == 4) {
|
||||||
|
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/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
|
angle -= 360 / 3;
|
||||||
|
}
|
||||||
|
angle = 0;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
Reference in New Issue
Block a user