From 799826a014014c2e4d2a4b78bf5dff07a9162e04 Mon Sep 17 00:00:00 2001 From: Surajit Maity Date: Sat, 3 Feb 2024 19:57:39 +0530 Subject: [PATCH 1/4] Difficulty Options ADDED --- assets/main.css | 8 ++++---- assets/main.html | 11 ++++++++++- assets/main.js | 42 +++++++++++++++++++++++++++++++++--------- 3 files changed, 47 insertions(+), 14 deletions(-) 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..2ce0617 100644 --- a/assets/main.html +++ b/assets/main.html @@ -513,7 +513,16 @@

Score: 0

2 mins 45 sec
-
+ +

+ +

Select Your Preferred Difficulty

+
+
+
+

+ +
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 ---------------- From 0d887b56706acef274b3bea52023d3216c617766 Mon Sep 17 00:00:00 2001 From: Surajit Maity Date: Sun, 4 Feb 2024 14:46:55 +0530 Subject: [PATCH 2/4] easy by default --- assets/main.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/main.html b/assets/main.html index 2ce0617..9ff5189 100644 --- a/assets/main.html +++ b/assets/main.html @@ -517,7 +517,7 @@

Score: 0



Select Your Preferred Difficulty

-
+


From a6f437dd6c5a7ccfe4d2942b597d637e33d286e6 Mon Sep 17 00:00:00 2001 From: Surajit Maity Date: Tue, 6 Feb 2024 19:03:52 +0530 Subject: [PATCH 3/4] Fixed selection problem --- assets/main.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/main.html b/assets/main.html index 9ff5189..6a55d76 100644 --- a/assets/main.html +++ b/assets/main.html @@ -517,7 +517,7 @@

Score: 0



Select Your Preferred Difficulty

-
+


From 2072b7852e69e266fd8adcfdb5a35ef82a27a8ab Mon Sep 17 00:00:00 2001 From: SURAJIT MAITY <111490250+Surajit0573@users.noreply.github.com> Date: Wed, 7 Feb 2024 00:25:31 +0530 Subject: [PATCH 4/4] Update main.html --- assets/main.html | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/assets/main.html b/assets/main.html index 6a55d76..869d62d 100644 --- a/assets/main.html +++ b/assets/main.html @@ -511,6 +511,7 @@

Score: 0

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

Select Your Preferred Difficulty

- \ No newline at end of file +