This commit is contained in:
2025-12-13 00:58:46 +01:00
parent f0308ddb3a
commit f6450cd3b8
17 changed files with 2401 additions and 32 deletions

View File

@@ -18,11 +18,11 @@ class FogOfWarSystem {
// Settings
this.settings = {
enabled: true,
enabled: false, // DISABLED - use weather fog instead
fogColor: 0x000000,
fogAlpha: 0.8,
exploredAlpha: 0.3,
visibleRadius: 5, // tiles
fogAlpha: 0.15, // Very light animated fog
exploredAlpha: 0.05, // Almost invisible for explored areas
visibleRadius: 8, // tiles (increased more)
smoothEdges: true,
persistMemory: true,
refogDungeons: true
@@ -159,7 +159,7 @@ class FogOfWarSystem {
}
/**
* Render fog based on current state
* Render fog based on current state - ANIMATED FOG EFFECT
*/
renderFog() {
if (!this.fogGraphics) return;
@@ -168,38 +168,55 @@ class FogOfWarSystem {
// Get camera bounds
const cam = this.scene.cameras.main;
const offsetX = this.scene.terrainOffsetX || 0;
const offsetY = this.scene.terrainOffsetY || 0;
const time = this.scene.time.now * 0.0005; // Slow animation
// Render fog tiles
// Render fog as smooth animated overlay
for (let y = 0; y < this.gridHeight; y++) {
for (let x = 0; x < this.gridWidth; x++) {
const state = this.fogGrid[y][x];
// Convert grid to screen coordinates
const iso = this.scene.iso || { toScreen: (x, y) => ({ x: x * 32, y: y * 32 }) };
const screenPos = iso.toScreen(x, y);
const screenX = screenPos.x + offsetX;
const screenY = screenPos.y + offsetY;
// Skip if visible
if (state === 2) continue;
// Only render if on screen
// Simple 2D tile coordinates
const screenX = x * this.tileSize;
const screenY = y * this.tileSize;
// Only render if on screen (with margin)
if (screenX < cam.scrollX - 100 || screenX > cam.scrollX + cam.width + 100) continue;
if (screenY < cam.scrollY - 100 || screenY > cam.scrollY + cam.height + 100) continue;
// Animated fog effect - wave pattern
const waveX = Math.sin(time + x * 0.1) * 5;
const waveY = Math.cos(time + y * 0.1) * 5;
if (state === 0) {
// Unexplored - full fog
this.fogGraphics.fillStyle(this.settings.fogColor, this.settings.fogAlpha);
this.fogGraphics.fillRect(screenX - 32, screenY - 16, 64, 32);
// Unexplored - animated fog particles
const alpha = this.settings.fogAlpha + Math.sin(time + x + y) * 0.05;
this.fogGraphics.fillStyle(this.settings.fogColor, alpha);
// Draw multiple overlapping circles for smooth fog
this.fogGraphics.fillCircle(
screenX + this.tileSize / 2 + waveX,
screenY + this.tileSize / 2 + waveY,
this.tileSize * 0.8
);
} else if (state === 1) {
// Explored but not visible - light fog
this.fogGraphics.fillStyle(this.settings.fogColor, this.settings.exploredAlpha);
this.fogGraphics.fillRect(screenX - 32, screenY - 16, 64, 32);
// Explored but not visible - very light animated fog
const alpha = this.settings.exploredAlpha + Math.sin(time + x + y) * 0.02;
this.fogGraphics.fillStyle(this.settings.fogColor, alpha);
// Smaller, lighter circles
this.fogGraphics.fillCircle(
screenX + this.tileSize / 2 + waveX,
screenY + this.tileSize / 2 + waveY,
this.tileSize * 0.6
);
}
// state === 2 (visible) - no fog
}
}
// Smooth edges if enabled
// Apply blur effect for smooth fog
if (this.settings.smoothEdges) {
this.fogGraphics.setBlendMode(Phaser.BlendModes.NORMAL);
}