feat: Add color variations for natural elements and dynamic water colors
This commit is contained in:
10
js/world.js
10
js/world.js
@@ -62,6 +62,16 @@ function setPixel(worldX, worldY, type) {
|
||||
const index = localY * CHUNK_SIZE + localX;
|
||||
|
||||
chunk[index] = type;
|
||||
|
||||
// Assign random color index for natural elements
|
||||
if (type === DIRT || type === GRASS || type === STONE || type === WOOD || type === LEAF) {
|
||||
const colorIndex = Math.floor(Math.random() * 10);
|
||||
setMetadata(worldX, worldY, { ...getMetadata(worldX, worldY) || {}, colorIndex });
|
||||
}
|
||||
else if (type === WATER) {
|
||||
const colorIndex = Math.floor(Math.random() * 10);
|
||||
setMetadata(worldX, worldY, { ...getMetadata(worldX, worldY) || {}, colorIndex, waterColorTimer: 0 });
|
||||
}
|
||||
}
|
||||
|
||||
function getPixel(worldX, worldY) {
|
||||
|
||||
Reference in New Issue
Block a user