use all paterns + fixes
This commit is contained in:
13
web/game.js
13
web/game.js
@@ -204,36 +204,36 @@ function randomAttackPattern(){
|
|||||||
|
|
||||||
function spawnRandomBullet(){
|
function spawnRandomBullet(){
|
||||||
|
|
||||||
let patern = random([3]);
|
let patern = random([1,2,3]);
|
||||||
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);
|
||||||
if (nextAttack == 1) {
|
if (nextAttack == 1) {
|
||||||
shotPosX = 500;
|
shotPosX = 500;
|
||||||
shotPosY = 100;
|
shotPosY = 100;
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
|
||||||
}
|
}
|
||||||
if (nextAttack == 2) {
|
if (nextAttack == 2) {
|
||||||
shotPosX = random(0, 1000);
|
shotPosX = random(0, 1000);
|
||||||
shotPosY = 600;
|
shotPosY = 600;
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
|
||||||
}
|
}
|
||||||
if (nextAttack == 3) {
|
if (nextAttack == 3) {
|
||||||
shotPosX = 0;
|
shotPosX = 0;
|
||||||
shotPosY = random(0, 600);
|
shotPosY = random(0, 600);
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
|
||||||
}
|
}
|
||||||
if (nextAttack == 4) {
|
if (nextAttack == 4) {
|
||||||
shotPosX = 1000;
|
shotPosX = 1000;
|
||||||
shotPosY = random(0, 600);
|
shotPosY = random(0, 600);
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (patern == 2) {
|
if (patern == 2) {
|
||||||
shotPosX = bounceX;
|
shotPosX = bounceX;
|
||||||
shotPosY = bounceY;
|
shotPosY = bounceY;
|
||||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved));
|
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved,0));
|
||||||
}
|
}
|
||||||
if (patern == 3) {
|
if (patern == 3) {
|
||||||
shotPosX = 500;
|
shotPosX = 500;
|
||||||
@@ -243,7 +243,6 @@ function spawnRandomBullet(){
|
|||||||
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));
|
bullets.push(new bullet(0, 100, radius, shotSpeed, shotPosX, shotPosY, hasMoved, angle));
|
||||||
angle -= 360 / 3;
|
angle -= 360 / 3;
|
||||||
bulletsspliced = bullets.splice(i);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user