DEBUG: Water animation troubleshooting - added debug logs to check tile generation and update loop
This commit is contained in:
@@ -339,7 +339,18 @@ class TerrainSystem {
|
||||
}
|
||||
}
|
||||
|
||||
console.log(`✅ World Init Complete. Loaded ${this.generatedChunks.size} chunks.`);
|
||||
console.log('✅ World Init Complete. Loaded ${this.generatedChunks.size} chunks.');
|
||||
|
||||
// DEBUG: Check how many water tiles were generated
|
||||
let waterCount = 0;
|
||||
for (let y = 0; y < this.height; y++) {
|
||||
for (let x = 0; x < this.width; x++) {
|
||||
if (this.tiles[y] && this.tiles[y][x] && this.tiles[y][x].type === 'water') {
|
||||
waterCount++;
|
||||
}
|
||||
}
|
||||
}
|
||||
console.log(`🌊 DEBUG: Generated ${waterCount} water tiles in world`);
|
||||
}
|
||||
|
||||
generateChunk(cx, cy) {
|
||||
@@ -1076,6 +1087,9 @@ class TerrainSystem {
|
||||
if (!this.waterCurrentFrame) this.waterCurrentFrame = 0;
|
||||
this.waterCurrentFrame = (this.waterCurrentFrame + 1) % 4; // Cycle 0-3
|
||||
|
||||
// DEBUG
|
||||
let waterTileCount = 0;
|
||||
|
||||
// Update vse visible water tiles s novim frame-om
|
||||
this.visibleTiles.forEach((sprite, key) => {
|
||||
const coords = key.split(',');
|
||||
@@ -1084,8 +1098,19 @@ class TerrainSystem {
|
||||
|
||||
if (this.tiles[y] && this.tiles[y][x] && this.tiles[y][x].type === 'water') {
|
||||
sprite.setTexture(`water_frame_${this.waterCurrentFrame}`);
|
||||
waterTileCount++;
|
||||
}
|
||||
});
|
||||
|
||||
// DEBUG LOG
|
||||
if (waterTileCount > 0) {
|
||||
console.log(`🌊 Water animation: frame ${this.waterCurrentFrame} updated ${waterTileCount} tiles`);
|
||||
} else {
|
||||
console.warn('⚠️ No water tiles found in visibleTiles!', {
|
||||
visibleTilesCount: this.visibleTiles.size,
|
||||
currentFrame: this.waterCurrentFrame
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user