refactor: Remove floor generation for second chunk at world bottom
This commit is contained in:
parent
d5f46d94c3
commit
eab3a9b790
@ -42,8 +42,8 @@ function getOrCreateChunk(chunkX, chunkY) {
|
||||
}
|
||||
}
|
||||
|
||||
// Add floor at the bottom of the world (y = 0 and y = 1)
|
||||
if (chunkY === 0 || chunkY === 1) {
|
||||
// Add floor at the bottom of the world (only at y = 0)
|
||||
if (chunkY === 0) {
|
||||
// Fill the bottom row with walls
|
||||
for (let x = 0; x < CHUNK_SIZE; x++) {
|
||||
chunkData[(CHUNK_SIZE - 1) * CHUNK_SIZE + x] = WALL;
|
||||
@ -386,9 +386,9 @@ function setPixel(worldX, worldY, type) {
|
||||
}
|
||||
|
||||
function getPixel(worldX, worldY) {
|
||||
// Special case: floor at the bottom of the world (first two chunks)
|
||||
// Special case: floor at the bottom of the world (only first chunk)
|
||||
const floorChunkY = Math.floor(worldY / CHUNK_SIZE);
|
||||
if (worldY % CHUNK_SIZE === CHUNK_SIZE - 1 && (floorChunkY === 0 || floorChunkY === 1)) {
|
||||
if (worldY % CHUNK_SIZE === CHUNK_SIZE - 1 && floorChunkY === 0) {
|
||||
return WALL;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user