feat: Improve stone layer visibility and rendering

This commit is contained in:
Kacper Kostka (aider)
2025-04-05 15:40:27 +02:00
parent 15fb106246
commit 883c3d9a08
3 changed files with 33 additions and 7 deletions

View File

@@ -49,7 +49,21 @@ function render() {
const index = y * CHUNK_SIZE + x;
const type = chunk[index];
if (type === EMPTY) continue;
// Always render stone layer even if it's not directly visible
if (type === EMPTY && chunkY !== 1) continue;
// For the stone layer (chunkY = 1), render a faint background even for empty spaces
if (type === EMPTY && chunkY === 1) {
// Use a very faint gray for empty spaces in the stone layer
ctx.fillStyle = 'rgba(100, 100, 100, 0.2)';
ctx.fillRect(
screenX + x * PIXEL_SIZE,
screenY + y * PIXEL_SIZE,
PIXEL_SIZE,
PIXEL_SIZE
);
continue;
}
// Set color based on type
if (type === SAND) {