feat: Spawn tree seeds 3 pixels above surface for better growth
This commit is contained in:
parent
0b96238226
commit
ec7f8f9522
@ -191,8 +191,10 @@ function generateSpecialChunk(chunkData, chunkX, playerChunkX) {
|
||||
}
|
||||
|
||||
// Only place the seed if there are no other seeds nearby
|
||||
if (!hasSeedNearby && seedY >= 0 && chunkData[(floorY - noiseHeight) * CHUNK_SIZE + x] === GRASS) {
|
||||
chunkData[seedY * CHUNK_SIZE + x] = TREE_SEED;
|
||||
// Place seed 3 pixels above the surface instead of just 1
|
||||
const elevatedSeedY = floorY - noiseHeight - 3; // 3 pixels above the grass
|
||||
if (!hasSeedNearby && elevatedSeedY >= 0 && chunkData[(floorY - noiseHeight) * CHUNK_SIZE + x] === GRASS) {
|
||||
chunkData[elevatedSeedY * CHUNK_SIZE + x] = TREE_SEED;
|
||||
// Add metadata for the tree seed
|
||||
const seedMetadata = {
|
||||
age: Math.floor(random() * 50), // Random initial age
|
||||
@ -287,7 +289,7 @@ function generateSpecialChunk(chunkData, chunkX, playerChunkX) {
|
||||
if (chunkData[surfaceY * CHUNK_SIZE + x] === GRASS) {
|
||||
// Reduced from 25% to 10% chance for a tree seed at each valid position
|
||||
if (random() < 0.1) {
|
||||
const seedY = surfaceY - 1; // Position above the grass
|
||||
const seedY = surfaceY - 3; // Position 3 pixels above the grass instead of just 1
|
||||
|
||||
// Check if this position is at least 5 pixels away from any existing tree seed
|
||||
let tooClose = false;
|
||||
|
Loading…
x
Reference in New Issue
Block a user