format
This commit is contained in:
16
web/game.js
16
web/game.js
@@ -192,7 +192,7 @@ function draw() {
|
||||
}
|
||||
}
|
||||
|
||||
function randomAttackPattern(){
|
||||
function randomAttackPattern() {
|
||||
if (shot == false || hit == true) {
|
||||
|
||||
spawnRandomBullet()
|
||||
@@ -202,38 +202,38 @@ function randomAttackPattern(){
|
||||
}
|
||||
}
|
||||
|
||||
function spawnRandomBullet(){
|
||||
function spawnRandomBullet() {
|
||||
|
||||
let patern = random([1,2,3]);
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
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));
|
||||
bullets.push(new bullet(playerPosX, playerPosY, radius, shotSpeed, shotPosX, shotPosY, hasMoved, 0));
|
||||
}
|
||||
if (patern == 3) {
|
||||
shotPosX = 500;
|
||||
|
Reference in New Issue
Block a user