diff options
-rw-r--r-- | html/rogue/js/config.js | 4 | ||||
-rw-r--r-- | html/rogue/js/fow.js | 9 | ||||
-rw-r--r-- | html/rogue/js/game.js | 15 |
3 files changed, 17 insertions, 11 deletions
diff --git a/html/rogue/js/config.js b/html/rogue/js/config.js index d2c0b36..71e7e0e 100644 --- a/html/rogue/js/config.js +++ b/html/rogue/js/config.js @@ -6,8 +6,8 @@ const Config = { HEX_FILL: '#ffffff', FOG: { HIDDEN: 'rgba(0, 0, 0, 1)', - REVEALED: 'rgba(0, 0, 0, 0.5)', - GRID_DIM: 'rgba(255, 255, 255, 1)' // For grid lines in revealed but not visible hexes + REVEALED: 'rgba(0, 0, 0, 0.25)', + GRID_DIM: 'rgba(0, 0, 0, 0.0)' }, UI: { INVENTORY: { diff --git a/html/rogue/js/fow.js b/html/rogue/js/fow.js index 7a2914e..291c862 100644 --- a/html/rogue/js/fow.js +++ b/html/rogue/js/fow.js @@ -65,11 +65,20 @@ const FogOfWar = { const fogState = this.getFogState(hex); if (fogState.alpha > 0) { const screen = HexGrid.toScreenCoordinates(hex, Camera); + + // Draw fog fill ctx.fillStyle = fogState === Config.fog.states.HIDDEN ? Config.colors.FOG.HIDDEN : Config.colors.FOG.REVEALED; HexGrid.drawHexPath(ctx, screen.x, screen.y, HexGrid.SIZE, 1); ctx.fill(); + + // Draw grid lines only for revealed but not visible hexes + if (fogState === Config.fog.states.REVEALED) { + ctx.strokeStyle = Config.colors.FOG.GRID_DIM; + ctx.lineWidth = 1; + ctx.stroke(); + } } }); } diff --git a/html/rogue/js/game.js b/html/rogue/js/game.js index 973c33d..f26e59b 100644 --- a/html/rogue/js/game.js +++ b/html/rogue/js/game.js @@ -41,21 +41,18 @@ function drawHex(ctx, x, y, hex) { return; } - // Draw the hex + // Draw the hex fill HexGrid.drawHexPath(ctx, screen.x, screen.y); - - // Fill hex ctx.fillStyle = Config.colors.HEX_FILL; ctx.fill(); - // Draw border with appropriate color based on visibility - if (!FogOfWar.isVisible(hex)) { - ctx.strokeStyle = Config.colors.FOG.GRID_DIM; - } else { + // Only draw grid lines for currently visible hexes + // (fog of war will handle the grid lines for revealed but not visible hexes) + if (FogOfWar.isVisible(hex)) { ctx.strokeStyle = Config.colors.GRID; + ctx.lineWidth = 1; + ctx.stroke(); } - ctx.lineWidth = 1; - ctx.stroke(); } function gameLoop(currentTime) { |