about summary refs log tree commit diff stats
path: root/html/broughlike
diff options
context:
space:
mode:
Diffstat (limited to 'html/broughlike')
-rw-r--r--html/broughlike/index.html37
1 files changed, 30 insertions, 7 deletions
diff --git a/html/broughlike/index.html b/html/broughlike/index.html
index 9afeb07..e643527 100644
--- a/html/broughlike/index.html
+++ b/html/broughlike/index.html
@@ -64,7 +64,9 @@
             damage: PLAYER_BASE_DAMAGE,
             totalDamageDone: 0,
             totalDamageTaken: 0,
-            cellsTraveled: 0
+            cellsTraveled: 0,
+            killCount: 0,
+            itemsCollected: 0
         };
 
         const exit = { x: Math.floor(Math.random() * GRID_SIZE), y: Math.floor(Math.random() * GRID_SIZE) };
@@ -227,18 +229,33 @@
             });
         }
 
+        function drawCharacterBorder(x, y, radius, damageTaken) {
+            const dashLength = 5;
+            const gapLength = Math.max(1, damageTaken * 2); // More damage, larger gaps
+
+            ctx.lineWidth = 2;
+            ctx.strokeStyle = '#2d2d2d';
+            ctx.setLineDash([dashLength, gapLength]);
+            ctx.beginPath();
+            ctx.arc(x, y, radius, 0, 2 * Math.PI);
+            ctx.stroke();
+            ctx.setLineDash([]); // Reset to a solid line
+        }
+
         function drawEnemies() {
             enemies.forEach(enemy => {
                 const x = enemy.x * tileSize + tileSize / 2;
                 const y = enemy.y * tileSize + tileSize / 2;
                 const opacity = enemy.health / MAX_ENEMY_HEALTH; // Opacity based on health
+                const radius = tileSize / 3;
+                const damageTaken = MAX_ENEMY_HEALTH - enemy.health;
+
                 ctx.beginPath();
-                ctx.arc(x, y, tileSize / 3, 0, 2 * Math.PI);
+                ctx.arc(x, y, radius, 0, 2 * Math.PI);
                 ctx.fillStyle = `${COLORS.enemy}${opacity})`;
                 ctx.fill();
-                ctx.lineWidth = 2;
-                ctx.strokeStyle = '#2d2d2d';
-                ctx.stroke();
+
+                drawCharacterBorder(x, y, radius, damageTaken);
             });
         }
 
@@ -283,6 +300,7 @@
         function handleItemCollection() {
             const collectedItem = items.find(item => item.x === player.x && item.y === player.y);
             if (collectedItem) {
+                player.itemsCollected++;
                 if (collectedItem.type === 'diamond') {
                     player.damage += 3;
                     console.log("Collected diamond! +3 damage on this level.");
@@ -375,7 +393,7 @@
                 player.totalDamageTaken++;
                 addCombatDots(cellX, cellY, COLORS.combatDotPlayer); // Add dots for player damage
                 console.log("Enemy hit! Player health: " + player.health);
-            } else {
+            } else {                
                 console.log("Enemy missed!");
             }
 
@@ -385,11 +403,12 @@
             console.log("Player hit! Enemy health: " + enemy.health);
 
             if (enemy.health <= 0) {
+                player.killCount++;
                 enemies = enemies.filter(e => e !== enemy);
             }
 
             if (player.health <= 0) {
-                alert(`Dead\n\nScore: ${player.score}\nDistance Traveled: ${player.cellsTraveled}\nTotal Damage Dealt: ${player.totalDamageDone}\nTotal Damage Received: ${player.totalDamageTaken}`);
+                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}`);
                 resetGame();
             }
         }
@@ -402,6 +421,8 @@
             player.totalDamageTaken = 0;
             player.cellsTraveled = 0;
             player.score = 0;
+            player.killCount = 0;
+            player.itemsCollected = 0;
             player.x = 0;
             player.y = 0;
             combatDots = {};
@@ -422,6 +443,8 @@
                 console.log("Distance Traveled: " + player.cellsTraveled);
                 console.log("Total Damage Dealt: " + player.totalDamageDone);
                 console.log("Total Damage Received: " + player.totalDamageTaken);
+                console.log("Circles Vanquished: " + player.killCount);
+                console.log("Items Collected: " + player.itemsCollected);
                 console.groupEnd();
                 combatDots = {};
                 generateExit();