Biome system for themed level variation. Assigns biomes to level regions and handles transitions.
Usage:
const biomes = new BiomeGenerator({ biomes: [ { name: 'forest', tilePalette: { floor: 10, wall: 11 }, enemyTypes: ['wolf', 'bear'] }, { name: 'cave', tilePalette: { floor: 20, wall: 21 }, enemyTypes: ['bat', 'spider'] }, ],});const biome = biomes.getBiomeForRegion(regionX, totalRegions);const tileIndex = biome.tilePalette['floor']; Copy
const biomes = new BiomeGenerator({ biomes: [ { name: 'forest', tilePalette: { floor: 10, wall: 11 }, enemyTypes: ['wolf', 'bear'] }, { name: 'cave', tilePalette: { floor: 20, wall: 21 }, enemyTypes: ['bat', 'spider'] }, ],});const biome = biomes.getBiomeForRegion(regionX, totalRegions);const tileIndex = biome.tilePalette['floor'];
Optional
Get all biomes
Get biome by name
Get biome for a region index (cycles through available biomes)
Get all available biome names
Get enemy types for a biome
Get blended biome for a tile in a transition zone. Returns the two biomes and a blend factor (0-1).
Check if two region indices are in a transition zone
Biome system for themed level variation. Assigns biomes to level regions and handles transitions.
Usage: