Grass becomes grass saplings when walked over

This commit is contained in:
Peter Stockings
2026-01-05 21:19:42 +11:00
parent ecf58dded1
commit 39528d297e
2 changed files with 6 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ export const TileType = {
EMPTY: 1, EMPTY: 1,
WALL: 4, WALL: 4,
GRASS: 15, GRASS: 15,
GRASS_SAPLINGS: 2,
EMPTY_DECO: 24, EMPTY_DECO: 24,
WALL_DECO: 12, WALL_DECO: 12,
EXIT: 8, EXIT: 8,
@@ -21,7 +22,8 @@ export interface TileBehavior {
export const TILE_DEFINITIONS: Record<number, TileBehavior> = { export const TILE_DEFINITIONS: Record<number, TileBehavior> = {
[TileType.EMPTY]: { id: TileType.EMPTY, isBlocking: false, isDestructible: false }, [TileType.EMPTY]: { id: TileType.EMPTY, isBlocking: false, isDestructible: false },
[TileType.WALL]: { id: TileType.WALL, isBlocking: true, isDestructible: false }, [TileType.WALL]: { id: TileType.WALL, isBlocking: true, isDestructible: false },
[TileType.GRASS]: { id: TileType.GRASS, isBlocking: false, isDestructible: true, isDestructibleByWalk: true, destructsTo: TileType.EMPTY }, [TileType.GRASS]: { id: TileType.GRASS, isBlocking: false, isDestructible: true, isDestructibleByWalk: true, destructsTo: TileType.GRASS_SAPLINGS },
[TileType.GRASS_SAPLINGS]: { id: TileType.GRASS_SAPLINGS, isBlocking: false, isDestructible: false },
[TileType.EMPTY_DECO]: { id: TileType.EMPTY_DECO, isBlocking: false, isDestructible: false }, [TileType.EMPTY_DECO]: { id: TileType.EMPTY_DECO, isBlocking: false, isDestructible: false },
[TileType.WALL_DECO]: { id: TileType.WALL_DECO, isBlocking: true, isDestructible: false }, [TileType.WALL_DECO]: { id: TileType.WALL_DECO, isBlocking: true, isDestructible: false },
[TileType.EXIT]: { id: TileType.EXIT, isBlocking: false, isDestructible: false }, [TileType.EXIT]: { id: TileType.EXIT, isBlocking: false, isDestructible: false },

View File

@@ -242,6 +242,9 @@ function decorate(width: number, height: number, tiles: Tile[], random: () => nu
// Create grass patches where noise is above threshold // Create grass patches where noise is above threshold
if (grassValue > 0.35) { if (grassValue > 0.35) {
tiles[i] = TileType.GRASS; tiles[i] = TileType.GRASS;
} else if (grassValue > 0.25) {
// Transition zone: Saplings around grass clumps
tiles[i] = TileType.GRASS_SAPLINGS;
} else { } else {
// Floor decorations (moss/rocks): clustered distribution // Floor decorations (moss/rocks): clustered distribution
const decoValue = decorationNoise.get((x + decorOffset) / 8, (y + decorOffset) / 8); const decoValue = decorationNoise.get((x + decorOffset) / 8, (y + decorOffset) / 8);