Phase 29: Gameplay Systems (5/5) - Structure interaction, NPCs, Enemies, Quests, Map
This commit is contained in:
@@ -27,6 +27,11 @@ class Flat2DTerrainSystem {
|
||||
this.chunkManager = null; // Will be set by GameScene
|
||||
this.chunkSize = 50; // Chunk size for rendering (matches ChunkManager)
|
||||
|
||||
// 🏛️ PHASE 28 SESSION 6: Structure support
|
||||
this.structureSystem = null; // Will be set by GameScene
|
||||
this.riverSystem = null; // Will be set by GameScene
|
||||
this.lakeSystem = null; // Will be set by GameScene
|
||||
|
||||
console.log('🎨 Flat2DTerrainSystem initialized (500x500 world)');
|
||||
}
|
||||
|
||||
@@ -442,6 +447,70 @@ class Flat2DTerrainSystem {
|
||||
continue; // Skip to next tile
|
||||
}
|
||||
|
||||
// 🏛️ PHASE 28 SESSION 6: Check for ROADS
|
||||
if (this.structureSystem && this.structureSystem.isRoad(x, y)) {
|
||||
// Get biome-specific road color
|
||||
const baseColor = (biome === 'desert') ? 0xcda869 :
|
||||
(biome === 'mountain') ? 0x9090a0 :
|
||||
(biome === 'swamp') ? 0x5a4a3d :
|
||||
0x8B7355; // Brown dirt road
|
||||
|
||||
const roadRect = this.scene.add.rectangle(worldX, worldY, size, size, baseColor, 1.0);
|
||||
roadRect.setOrigin(0, 0);
|
||||
roadRect.setDepth(1.5); // Above ground, below decorations
|
||||
chunk.sprites.push(roadRect);
|
||||
|
||||
// Add some variation to road texture
|
||||
if (Math.random() < 0.3) {
|
||||
const detail = this.scene.add.rectangle(
|
||||
worldX + Math.random() * size,
|
||||
worldY + Math.random() * size,
|
||||
size * 0.3,
|
||||
size * 0.3,
|
||||
baseColor - 0x202020,
|
||||
0.5
|
||||
);
|
||||
detail.setOrigin(0, 0);
|
||||
detail.setDepth(1.5);
|
||||
chunk.sprites.push(detail);
|
||||
}
|
||||
|
||||
// Roads block biome features
|
||||
continue;
|
||||
}
|
||||
|
||||
// 🏛️ PHASE 28 SESSION 6: Check for STRUCTURES
|
||||
const structureData = this.structureSystem ? this.structureSystem.getStructure(x, y) : null;
|
||||
if (structureData) {
|
||||
// Structure exists here - render visual marker
|
||||
if (structureData.type === 'landmark') {
|
||||
// Landmark marker (large, special)
|
||||
const landmarkMarker = this.scene.add.rectangle(worldX, worldY, size, size, 0xFFD700, 0.7);
|
||||
landmarkMarker.setOrigin(0, 0);
|
||||
landmarkMarker.setDepth(5);
|
||||
chunk.sprites.push(landmarkMarker);
|
||||
|
||||
// Add a star symbol for landmarks (simple)
|
||||
const star = this.scene.add.text(worldX + size / 2, worldY + size / 2, '★', {
|
||||
fontSize: '20px',
|
||||
color: '#ffffff'
|
||||
});
|
||||
star.setOrigin(0.5, 0.5);
|
||||
star.setDepth(6);
|
||||
chunk.sprites.push(star);
|
||||
} else if (structureData.type === 'structure') {
|
||||
// Regular structure marker
|
||||
const structureColor = this.getStructureColor(structureData.structureType);
|
||||
const structureMarker = this.scene.add.rectangle(worldX, worldY, size, size, structureColor, 0.8);
|
||||
structureMarker.setOrigin(0, 0);
|
||||
structureMarker.setDepth(4);
|
||||
chunk.sprites.push(structureMarker);
|
||||
}
|
||||
|
||||
// Structures block biome features
|
||||
continue;
|
||||
}
|
||||
|
||||
// 🌈 Apply mixed features for transitions
|
||||
let features = [];
|
||||
|
||||
@@ -610,6 +679,45 @@ class Flat2DTerrainSystem {
|
||||
return graphics;
|
||||
}
|
||||
|
||||
// 🏛️ PHASE 28 SESSION 6: Get color for structure type
|
||||
getStructureColor(structureType) {
|
||||
const colors = {
|
||||
// Grassland structures
|
||||
'farm': 0x8B4513,
|
||||
'house': 0xA0522D,
|
||||
'barn': 0x654321,
|
||||
'windmill': 0xD2691E,
|
||||
'well': 0x708090,
|
||||
|
||||
// Forest structures
|
||||
'cabin': 0x8B4513,
|
||||
'ruins': 0x696969,
|
||||
'treehouse': 0x8B7355,
|
||||
'camp': 0x8B4513,
|
||||
'shrine': 0x9370DB,
|
||||
|
||||
// Desert structures
|
||||
'pyramid': 0xDAA520,
|
||||
'oasis_camp': 0x8B7355,
|
||||
'tomb': 0xCD853F,
|
||||
'pillar': 0xD2B48C,
|
||||
|
||||
// Mountain structures
|
||||
'mine': 0x2F4F4F,
|
||||
'cave': 0x363636,
|
||||
'tower': 0x708090,
|
||||
'altar': 0x9370DB,
|
||||
|
||||
// Swamp structures
|
||||
'hut': 0x556B2F,
|
||||
'totem': 0x8B4513,
|
||||
'bog_shrine': 0x6B8E23,
|
||||
'abandoned_dock': 0x654321
|
||||
};
|
||||
|
||||
return colors[structureType] || 0x808080; // Default gray
|
||||
}
|
||||
|
||||
getTileTexture(tileType) {
|
||||
const types = Map2DData.tileTypes;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user