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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user