about summary refs log tree commit diff stats
path: root/html
diff options
context:
space:
mode:
Diffstat (limited to 'html')
-rw-r--r--html/broughlike/about.html7
-rw-r--r--html/broughlike/index.html19
2 files changed, 20 insertions, 6 deletions
diff --git a/html/broughlike/about.html b/html/broughlike/about.html
index 0811f77..9f46567 100644
--- a/html/broughlike/about.html
+++ b/html/broughlike/about.html
@@ -8,6 +8,7 @@
     <style>
         body {
             background-color: #f0f0f0;
+            font-size: x-large;
             padding: 1em 2em;
         }
     </style>
@@ -17,11 +18,11 @@
     <ul>
         <li>You are the hexagon.</li>
         <li>Your goal is to reach the triangle. When you reach the triangle you'll be brought to the next level.</li>
-        <li>Enemies are circles. Run into them to battle. Be warned, you'll also take damage.</li>
+        <li>Enemies are circles. Run into them to battle. Be warned, you'll also take damage when you battle.</li>
         <li>Diamonds add 3 to the amount of damage you can do to an enemy for the level.</li>
-        <li>Pentagons heal you a little bit.</li>
+        <li>Pentagons restore a little bit of your health.</li>
         <li>You can tell your or an enemy's health by the opacity of the shape. Darker means more health.</li>
-        <li>Arrow keys, WASD, or VIM movement keys to move on a thing with a keyboard, swipe up, down, left or right to move on something with a touchscreen.</li>
+        <li>Arrow keys, WASD, or VIM movement keys to move on a thing with a keyboard. Swipe up, down, left or right to move on something with a touchscreen.</li>
     </ul>
     <p><a href="index.html">Play the game!</a></p>
 </body>
diff --git a/html/broughlike/index.html b/html/broughlike/index.html
index b5a4f09..391b6b9 100644
--- a/html/broughlike/index.html
+++ b/html/broughlike/index.html
@@ -8,6 +8,7 @@
     <style>
         body {
             background-color: #f0f0f0;
+            font-size: x-large;
         }
         canvas {
             width: 90vw; 
@@ -43,7 +44,8 @@
         const PLAYER_MAX_HEALTH = 16;
         const PLAYER_BASE_DAMAGE = 1;
         const ENEMY_CHASE_DISTANCE = 4;
-        const MAX_ENEMIES_ON_LEVEL = 3;
+        const MIN_ENEMIES_ON_LEVEL = 1;
+        const MAX_ENEMIES_ON_LEVEL = 4;
         const MAX_ENEMY_HEALTH = 7;
         const MIN_ENEMY_HEALTH = 2;
         const WALLS_MIN = 5;
@@ -52,6 +54,8 @@
         const ITEMS_MAX = 3;
         const DOTS_PER_HIT = 7;
 
+        let highScore = localStorage.getItem('highScore') || 0;
+
         const canvas = document.getElementById('gameCanvas');
         const ctx = canvas.getContext('2d');
         let tileSize = canvas.width / GRID_SIZE;
@@ -94,7 +98,11 @@
 
         function generateEnemies() {
             enemies = [];
-            const numEnemies = Math.floor(Math.random() * (MAX_ENEMIES_ON_LEVEL + 1)); // Between 0 and the constant value.
+            // Generate between 0 and MAX_ENEMIES_ON_LEVEL enemies if the player's score is 4 or lower
+            // Generate between MIN_ENEMIES_ON_LEVEL and MAX_ENEMIES_ON_LEVEL enemies if the player's score is 5 or higher
+            const numEnemies = player.score > 4 
+                ? Math.floor(Math.random() * (MAX_ENEMIES_ON_LEVEL - MIN_ENEMIES_ON_LEVEL + 1)) + MIN_ENEMIES_ON_LEVEL 
+                : Math.floor(Math.random() * (MAX_ENEMIES_ON_LEVEL + 1));
             for (let i = 0; i < numEnemies; i++) {
                 let enemyX, enemyY;
                 do {
@@ -458,7 +466,11 @@
             }
 
             if (player.health <= 0) {
-                alert(`Dead\n\nScore: ${player.score}\nDistance Traveled: ${player.cellsTraveled}\nTotal Damage Dealt: ${player.totalDamageDone}\nTotal Damage Received: ${player.totalDamageTaken}\nCircles Vanquished: ${player.killCount}\nItems Collected: ${player.itemsCollected}`);
+                if (player.score > highScore) {
+                    highScore = player.score;
+                    localStorage.setItem('highScore', highScore);
+                }
+                alert(`Score: ${player.score}\nDistance Traveled: ${player.cellsTraveled}\nTotal Damage Dealt: ${player.totalDamageDone}\nTotal Damage Received: ${player.totalDamageTaken}\n\nHigh Score: ${highScore}`);
                 resetGame();
             }
         }
@@ -495,6 +507,7 @@
                 console.log("Total Damage Received: " + player.totalDamageTaken);
                 console.log("Circles Vanquished: " + player.killCount);
                 console.log("Items Collected: " + player.itemsCollected);
+                console.log("High Score: " + highScore);
                 console.groupEnd();
                 combatDots = {};
                 generateExit();