From 40fa780d934ec61862804d16a85cb9399d2c312b Mon Sep 17 00:00:00 2001 From: elioat <{ID}+{username}@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:03:33 -0400 Subject: * --- html/broughlike/index.html | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'html/broughlike') diff --git a/html/broughlike/index.html b/html/broughlike/index.html index 9afeb07..ef547e7 100644 --- a/html/broughlike/index.html +++ b/html/broughlike/index.html @@ -227,18 +227,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); }); } @@ -375,7 +390,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!"); } -- cgit 1.4.1-2-gfad0 From 9fdf2ebdd7d6b0cb09a7f9874c46e82feb9fb356 Mon Sep 17 00:00:00 2001 From: elioat <{ID}+{username}@users.noreply.github.com> Date: Mon, 21 Oct 2024 10:22:48 -0400 Subject: * --- html/broughlike/index.html | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'html/broughlike') diff --git a/html/broughlike/index.html b/html/broughlike/index.html index ef547e7..34e40e2 100644 --- a/html/broughlike/index.html +++ b/html/broughlike/index.html @@ -64,7 +64,8 @@ damage: PLAYER_BASE_DAMAGE, totalDamageDone: 0, totalDamageTaken: 0, - cellsTraveled: 0 + cellsTraveled: 0, + killCount: 0 }; const exit = { x: Math.floor(Math.random() * GRID_SIZE), y: Math.floor(Math.random() * GRID_SIZE) }; @@ -400,11 +401,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}\nEnemies Vanquished: ${player.killCount}`); resetGame(); } } -- cgit 1.4.1-2-gfad0 From 0869a24d9ad412b1f6360de5cf7f318521966815 Mon Sep 17 00:00:00 2001 From: elioat Date: Mon, 21 Oct 2024 11:08:28 -0400 Subject: * --- html/broughlike/index.html | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'html/broughlike') diff --git a/html/broughlike/index.html b/html/broughlike/index.html index 34e40e2..2d09c92 100644 --- a/html/broughlike/index.html +++ b/html/broughlike/index.html @@ -406,7 +406,7 @@ } if (player.health <= 0) { - alert(`Dead\n\nScore: ${player.score}\nDistance Traveled: ${player.cellsTraveled}\nTotal Damage Dealt: ${player.totalDamageDone}\nTotal Damage Received: ${player.totalDamageTaken}\nEnemies Vanquished: ${player.killCount}`); + alert(`Dead\n\nScore: ${player.score}\nDistance Traveled: ${player.cellsTraveled}\nTotal Damage Dealt: ${player.totalDamageDone}\nTotal Damage Received: ${player.totalDamageTaken}\nCircles Vanquished: ${player.killCount}`); resetGame(); } } @@ -419,6 +419,7 @@ player.totalDamageTaken = 0; player.cellsTraveled = 0; player.score = 0; + player.killCount = 0; player.x = 0; player.y = 0; combatDots = {}; @@ -439,6 +440,7 @@ 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.groupEnd(); combatDots = {}; generateExit(); -- cgit 1.4.1-2-gfad0 From 8aa57714f30a29558e949bd7b52c0ea9cafec1fb Mon Sep 17 00:00:00 2001 From: elioat Date: Mon, 21 Oct 2024 11:16:59 -0400 Subject: * --- html/broughlike/index.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'html/broughlike') diff --git a/html/broughlike/index.html b/html/broughlike/index.html index 2d09c92..e643527 100644 --- a/html/broughlike/index.html +++ b/html/broughlike/index.html @@ -65,7 +65,8 @@ totalDamageDone: 0, totalDamageTaken: 0, cellsTraveled: 0, - killCount: 0 + killCount: 0, + itemsCollected: 0 }; const exit = { x: Math.floor(Math.random() * GRID_SIZE), y: Math.floor(Math.random() * GRID_SIZE) }; @@ -299,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."); @@ -406,7 +408,7 @@ } 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}`); + 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(); } } @@ -420,6 +422,7 @@ player.cellsTraveled = 0; player.score = 0; player.killCount = 0; + player.itemsCollected = 0; player.x = 0; player.y = 0; combatDots = {}; @@ -441,6 +444,7 @@ 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(); -- cgit 1.4.1-2-gfad0