added restart button in lives === 0 if
This commit is contained in:
27
web/game.js
27
web/game.js
@@ -64,20 +64,19 @@ function life() {
|
|||||||
textSize(40);
|
textSize(40);
|
||||||
textAlign(CENTER);
|
textAlign(CENTER);
|
||||||
text("Game Over", 500, 300);
|
text("Game Over", 500, 300);
|
||||||
|
if (key == ' ') {
|
||||||
|
lives = 1;
|
||||||
|
time = 0;
|
||||||
|
bounceX = bossPosX;
|
||||||
|
bounceY = bossPosY;
|
||||||
|
initialPlayerPosX = playerPosX;
|
||||||
|
initialPlayerPosY = playerPosY;
|
||||||
|
hasMoved = false;
|
||||||
|
bullets = [];
|
||||||
|
shot = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (key == ' ') {
|
|
||||||
lives = 1;
|
|
||||||
time = 0;
|
|
||||||
bounceX = bossPosX;
|
|
||||||
bounceY = bossPosY;
|
|
||||||
initialPlayerPosX = playerPosX;
|
|
||||||
initialPlayerPosY = playerPosY;
|
|
||||||
hasMoved = false;
|
|
||||||
bullets = [];
|
|
||||||
shot = false;
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function movementCheck() {
|
function movementCheck() {
|
||||||
@@ -206,7 +205,7 @@ function randomAttackPattern() {
|
|||||||
|
|
||||||
function spawnRandomBullet() {
|
function spawnRandomBullet() {
|
||||||
|
|
||||||
let patern = random([1,2,3,4]);
|
let patern = random([2]);
|
||||||
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);
|
||||||
|
Reference in New Issue
Block a user