feat: Add stone layer beneath terrain generation
This commit is contained in:
parent
ec7f8f9522
commit
d5f46d94c3
@ -33,6 +33,15 @@ function getOrCreateChunk(chunkX, chunkY) {
|
|||||||
// Create a new chunk with empty pixels
|
// Create a new chunk with empty pixels
|
||||||
const chunkData = new Array(CHUNK_SIZE * CHUNK_SIZE).fill(EMPTY);
|
const chunkData = new Array(CHUNK_SIZE * CHUNK_SIZE).fill(EMPTY);
|
||||||
|
|
||||||
|
// Fill the chunk below the floor (y = -1) completely with stone
|
||||||
|
if (chunkY === -1) {
|
||||||
|
for (let y = 0; y < CHUNK_SIZE; y++) {
|
||||||
|
for (let x = 0; x < CHUNK_SIZE; x++) {
|
||||||
|
chunkData[y * CHUNK_SIZE + x] = STONE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Add floor at the bottom of the world (y = 0 and y = 1)
|
// Add floor at the bottom of the world (y = 0 and y = 1)
|
||||||
if (chunkY === 0 || chunkY === 1) {
|
if (chunkY === 0 || chunkY === 1) {
|
||||||
// Fill the bottom row with walls
|
// Fill the bottom row with walls
|
||||||
|
Loading…
x
Reference in New Issue
Block a user