diff options
Diffstat (limited to 'html/tower/js/renderer.js')
-rw-r--r-- | html/tower/js/renderer.js | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/html/tower/js/renderer.js b/html/tower/js/renderer.js index f37b5f3..29dd35f 100644 --- a/html/tower/js/renderer.js +++ b/html/tower/js/renderer.js @@ -92,11 +92,10 @@ function renderEnemies(ctx, enemies) { const opacity = 0.3 + (healthPercent * 0.7); // Dynamic color based on enemy state - ctx.fillStyle = `${EnemyTypes[enemy.type].color}${Math.floor(opacity * 255).toString(16).padStart(2, '0')}`; - ctx.strokeStyle = 'rgba(0, 0, 0, 0.8)'; - ctx.lineWidth = 2; + const color = EnemyTypes[enemy.type].color; + const hexOpacity = Math.floor(opacity * 255).toString(16).padStart(2, '0'); - // Enemy body + // Draw enemy body with solid black border ctx.beginPath(); ctx.arc( (enemy.position.x + 0.5) * cellSize, @@ -105,7 +104,14 @@ function renderEnemies(ctx, enemies) { 0, Math.PI * 2 ); + + // Fill with dynamic opacity + ctx.fillStyle = `${color}${hexOpacity}`; ctx.fill(); + + // Add solid black border + ctx.strokeStyle = 'black'; + ctx.lineWidth = 2; ctx.stroke(); // Range indicator for special enemy types |