diff --git a/assets/main.css b/assets/main.css index d589c4b..7db2405 100644 --- a/assets/main.css +++ b/assets/main.css @@ -1329,7 +1329,7 @@ h1 { } #gameplayTime { - height: 54vh; + height: 80vh; } #gameplayTime div button { @@ -1654,7 +1654,7 @@ h1 { } #gameplayTime { - background: rgb(249, 249, 202); + background: rgb(249,249,202); background: radial-gradient(circle, rgb(230, 252, 255) 26%, rgb(112, 245, 240) 100%); border-width: 10px; border-style: solid; @@ -1670,12 +1670,12 @@ h1 { justify-content: center; width: 50vw; margin-bottom: 10rem; - height: 40vh; + margin-top: 15vh; flex-direction: column; justify-content: space-evenly; transition: all 0.5s ease-in-out; /* animation-name: scaleMenu;*/ - transform: scale(1); + transform: scale(1); border-radius: 20px; } diff --git a/assets/main.html b/assets/main.html index a7e9a10..869d62d 100644 --- a/assets/main.html +++ b/assets/main.html @@ -511,9 +511,19 @@

Score: 0

Howdy, partner! How many hours of rootin' tootin' gameplay have you clocked up on this game?
2 mins 45 sec
+
-
+ +

+ +

Select Your Preferred Difficulty

+
+
+
+

+ +
@@ -551,4 +561,4 @@

Score: 0

- \ No newline at end of file + diff --git a/assets/main.js b/assets/main.js index c61410c..c4fc6a9 100644 --- a/assets/main.js +++ b/assets/main.js @@ -128,10 +128,14 @@ setInterval(() => { // -------------- bomb management section ---------------- var totalBombs = 0; // total number of bombs on screen at a time -var MAX_BOMBS = 7; // maximum number of bombs that can be on screen -var MAX_BOMB_LIFE = 5; // maximum life of a bomb -var MAX_LIVES = 3; // maximum number of lives -var lives = MAX_LIVES; // current number of lives +var MAX_BOMBS; // maximum number of bombs that can be on screen +var MAX_BOMB_LIFE; // maximum life of a bomb +var MAX_LIVES; // maximum number of lives +var lives; // current number of lives +var prob; //probublity of creating a bomb +var timegap_edible; +var timegap_rotten; +var prob_rotten; // create a new bomb function createBomb() { @@ -370,6 +374,26 @@ function chooseGameplayTime() { } function closeGameplayDialog() { + + //Taking the value from difficulity options + var ele = document.getElementsByName('mode'); + var val; + for (i = 0; i < ele.length; i++) { + if (ele[i].checked) + val = ele[i].value; + } + + //changed the values accordingly + MAX_BOMBS = 7 * val; // maximum number of bombs that can be on screen + MAX_BOMB_LIFE = 5 * val; // maximum life of a bomb + MAX_LIVES = (3 - val) + 1; // maximum number of lives + prob = 0.3 * val; //probublity of creating a bomb + lives = MAX_LIVES; //max number of lives + timegap_edible = (1000 / val); //time between two edible + timegap_rotten = (1500 / val); //time gap betwen two rotten + prob_rotten = 0.3 * val; //probablity of rotten creating + + isRunning = 1; seconds = parseInt(document.getElementById("time-range").value) - 1; setTimeout(createEdible, 1000); @@ -485,7 +509,7 @@ function decreaseTime() { // -------------- bomb management section ---------------- if (totalBombs < MAX_BOMBS) { // check if there are already more than enough bombs present on screen - if (Math.random() < 0.5) { // randomly decide whether to create a bomb or not + if (Math.random() < prob) { // randomly decide whether to create a bomb or not createBomb(); totalBombs++; } @@ -590,12 +614,12 @@ function catchEdible() { } function addEdibles() { - setTimeout(createEdible, 1000); + setTimeout(createEdible, timegap_edible); // add rotten edibles also - if (Math.random() < 0.3) - setTimeout(createRottenEdible, 1500); + if (Math.random() < prob_rotten) + setTimeout(createRottenEdible, timegap_rotten); else - setTimeout(createEdible, 1500); + setTimeout(createEdible, timegap_rotten); } // -------------- edible management section ----------------