Implement randomized tile textures.

- DungeonGenerator: Selects a random texture from the card definition when finalizing tile placement.
- GameRenderer: Renders the specific chosen texture for each tile instance instead of the default.
This commit is contained in:
2026-01-03 00:19:30 +01:00
parent 7462dd7fed
commit cd6abb016f
2 changed files with 12 additions and 2 deletions

View File

@@ -261,11 +261,20 @@ export class DungeonGenerator {
placeCardFinal(card, x, y, rotation) {
const variant = card.variants[rotation];
// Randomize Texture if multiple are available
let selectedTexture = null;
if (card.textures && card.textures.length > 0) {
const idx = Math.floor(Math.random() * card.textures.length);
selectedTexture = card.textures[idx];
console.log(`[DungeonGenerator] Selected texture for ${card.id}:`, selectedTexture);
}
const instance = {
id: `tile_${this.placedTiles.length}`,
defId: card.id,
x, y, rotation,
name: card.name
name: card.name,
texture: selectedTexture
};
this.grid.placeTile(instance, variant, card);