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:
47
web/game.js
47
web/game.js
@@ -25,7 +25,6 @@ let shotPosY;
|
|||||||
let initialPlayerPosX = playerPosX;
|
let initialPlayerPosX = playerPosX;
|
||||||
let initialPlayerPosY = playerPosY;
|
let initialPlayerPosY = playerPosY;
|
||||||
|
|
||||||
let nextAttack;
|
|
||||||
let bullets = [];
|
let bullets = [];
|
||||||
let direction;
|
let direction;
|
||||||
let framerate = 120;
|
let framerate = 120;
|
||||||
@@ -48,7 +47,7 @@ let y5;
|
|||||||
let homescreenOn = false;
|
let homescreenOn = false;
|
||||||
let chosen = false;
|
let chosen = false;
|
||||||
|
|
||||||
let bulletAmount = 10;
|
let bulletAmount = 20;
|
||||||
//let myBullet = new bullet();
|
//let myBullet = new bullet();
|
||||||
// the function setup() is called once when the page is loaded
|
// the function setup() is called once when the page is loaded
|
||||||
function setup() {
|
function setup() {
|
||||||
@@ -229,7 +228,7 @@ function draw() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
async function randPatern () {
|
async function randPatern () {
|
||||||
patern = random([1,2]);
|
patern = random([5]);
|
||||||
chosen = true;
|
chosen = true;
|
||||||
if (patern == 1) {
|
if (patern == 1) {
|
||||||
await wait(3000);
|
await wait(3000);
|
||||||
@@ -239,6 +238,10 @@ async function randPatern () {
|
|||||||
await wait(5000);
|
await wait(5000);
|
||||||
chosen = false;
|
chosen = false;
|
||||||
}
|
}
|
||||||
|
if (patern == 5) {
|
||||||
|
await wait(30000);
|
||||||
|
chosen = false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,7 +259,7 @@ function spawnRandomBullet() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (patern == 1) {
|
if (patern == 1) {
|
||||||
nextAttack = random([1, 2, 3, 4, 5]);
|
let nextAttack = random([1, 2, 3, 4, 5]);
|
||||||
//text(nextAttack, 30, 50);
|
//text(nextAttack, 30, 50);
|
||||||
if (nextAttack == 1) {
|
if (nextAttack == 1) {
|
||||||
shotPosX = bossPosX;
|
shotPosX = bossPosX;
|
||||||
@@ -329,6 +332,42 @@ function spawnRandomBullet() {
|
|||||||
}
|
}
|
||||||
angle = 0;
|
angle = 0;
|
||||||
}
|
}
|
||||||
|
if (patern == 5) {
|
||||||
|
let nextAttack = random([1, 2, 3]);
|
||||||
|
if (nextAttack == 1) {
|
||||||
|
for (let i = 0; i < random(3, 10); i++) {
|
||||||
|
let shotWidth = random(0, width);
|
||||||
|
shotPosX = shotWidth
|
||||||
|
shotPosY = height;
|
||||||
|
bullets.push(new bullet(shotWidth, 0, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextAttack == 2) {
|
||||||
|
for (let i = 0; i < random(3, 10); i++) {
|
||||||
|
let shotWidth = random(0, width);
|
||||||
|
shotPosX = shotWidth
|
||||||
|
shotPosY = 0;
|
||||||
|
bullets.push(new bullet(shotWidth, height, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextAttack == 3) {
|
||||||
|
for (let i = 0; i < random(3, 10); i++) {
|
||||||
|
let shotHeight = random(0, width);
|
||||||
|
shotPosX = 0
|
||||||
|
shotPosY = shotHeight;
|
||||||
|
bullets.push(new bullet(width, shotHeight, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (nextAttack == 3) {
|
||||||
|
for (let i = 0; i < random(3, 10); i++) {
|
||||||
|
let shotHeight = random(0, width);
|
||||||
|
shotPosX = width
|
||||||
|
shotPosY = shotHeight;
|
||||||
|
bullets.push(new bullet(0, shotHeight, radius, shotSpeed/4, shotPosX, shotPosY, hasMoved, angle));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user