diff options
author | elioat <elioat@tilde.institute> | 2024-12-28 09:56:22 -0500 |
---|---|---|
committer | elioat <elioat@tilde.institute> | 2024-12-28 09:56:22 -0500 |
commit | 0e21da444131ebc4b30230de829ea0d1f2410f0b (patch) | |
tree | 1d21c412278691ba3196f3baae8fde16859b855e | |
parent | eed3c76d745f37ade56d0cc4ed8486913cd8e1f7 (diff) | |
download | tour-0e21da444131ebc4b30230de829ea0d1f2410f0b.tar.gz |
*
-rw-r--r-- | html/rogue/js/config.js | 4 | ||||
-rw-r--r-- | html/rogue/js/fow.js | 4 | ||||
-rw-r--r-- | html/rogue/js/game.js | 15 | ||||
-rw-r--r-- | html/rogue/js/hex.js | 2 |
4 files changed, 9 insertions, 16 deletions
diff --git a/html/rogue/js/config.js b/html/rogue/js/config.js index afd1123..50687ba 100644 --- a/html/rogue/js/config.js +++ b/html/rogue/js/config.js @@ -1,6 +1,6 @@ const Config = { colors: { - BACKGROUND: 'rgba(135, 206, 235, 0.3)', + BACKGROUND: 'rgba(135, 207, 235, 1)', GRID: 'rgba(0, 0, 0, 0.25)', PLAYER: 'red', HEX_FILL: '#ffffff' @@ -8,7 +8,7 @@ const Config = { hex: { SIZE: 40, // Size of a single hex - GRID_SIZE: 100, // Number of hexes in the grid (width/height) + GRID_SIZE: 10, // Number of hexes in the grid (width/height) get WIDTH() { // Computed hex width return this.SIZE * 2; }, diff --git a/html/rogue/js/fow.js b/html/rogue/js/fow.js index 69a5d61..e3a1c15 100644 --- a/html/rogue/js/fow.js +++ b/html/rogue/js/fow.js @@ -61,10 +61,10 @@ const FogOfWar = { const screenY = Math.round(pixel.y - Camera.y); if (!this.isRevealed(hex)) { - ctx.fillStyle = 'rgba(0, 0, 0, 1)'; + ctx.fillStyle = 'rgba(0, 0, 0, 1)'; // Completely opaque for unrevealed this.drawHexShape(ctx, screenX, screenY); } else if (!this.isVisible(hex)) { - ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; + ctx.fillStyle = 'rgba(0, 0, 0, 0.5)'; // Semi-transparent for revealed but not visible this.drawHexShape(ctx, screenX, screenY); } }); diff --git a/html/rogue/js/game.js b/html/rogue/js/game.js index 53700c9..f84d670 100644 --- a/html/rogue/js/game.js +++ b/html/rogue/js/game.js @@ -38,8 +38,8 @@ function drawHex(ctx, x, y, hex) { return; } - // Only draw hex if it's been revealed or is currently visible - if (FogOfWar.isRevealed(hex) || FogOfWar.isVisible(hex)) { + // Only draw hex if it's been revealed + if (FogOfWar.isRevealed(hex)) { ctx.beginPath(); for (let i = 0; i < 6; i++) { const angle = 2 * Math.PI / 6 * i; @@ -53,18 +53,11 @@ function drawHex(ctx, x, y, hex) { } ctx.closePath(); - // Fill hex with appropriate color - if (HexGrid.isPassable(hex)) { - ctx.fillStyle = Config.colors.HEX_FILL; - } else { - ctx.fillStyle = Config.colors.BACKGROUND; - } + ctx.fillStyle = Config.colors.HEX_FILL; ctx.fill(); // Draw border with appropriate color based on visibility - if (!FogOfWar.isRevealed(hex)) { - ctx.strokeStyle = 'rgba(0, 0, 0, 1)'; // Match full shadow color - } else if (!FogOfWar.isVisible(hex)) { + if (!FogOfWar.isVisible(hex)) { ctx.strokeStyle = 'rgba(0, 0, 0, 0.25)'; } else { ctx.strokeStyle = HexGrid.COLOR; // Normal grid color diff --git a/html/rogue/js/hex.js b/html/rogue/js/hex.js index b2e1a82..817d0a3 100644 --- a/html/rogue/js/hex.js +++ b/html/rogue/js/hex.js @@ -6,7 +6,7 @@ const HexGrid = { get HEIGHT() { return Config.hex.HEIGHT }, get GRID_SIZE() { return Config.hex.GRID_SIZE }, COLOR: Config.colors.GRID, - IMPASSABLE_COLOR: Config.colors.BACKGROUND, + IMPASSABLE_COLOR: "rgba(255, 0, 0, 0.967)", // hex to pixel toPixel(hex) { |