Phase 7: World Structure (New Direction)

This commit is contained in:
2025-12-08 10:56:47 +01:00
parent b79b70dcc1
commit b750f320fc
7 changed files with 491 additions and 10 deletions

View File

@@ -39,6 +39,17 @@ class InteractionSystem {
}
}
// Check for chests
if (this.scene.chests) {
for (const chest of this.scene.chests) {
const d = Phaser.Math.Distance.Between(playerPos.x, playerPos.y, chest.gridX, chest.gridY);
if (d < minDist && !chest.isOpened) {
minDist = d;
nearest = chest;
}
}
}
for (const npc of candidates) {
const d = Phaser.Math.Distance.Between(playerPos.x, playerPos.y, npc.gridX, npc.gridY);
if (d < minDist) {
@@ -48,10 +59,14 @@ class InteractionSystem {
}
if (nearest) {
console.log('E Interacted with:', nearest.type);
console.log('E Interacted with:', nearest.type || nearest.lootTable);
if (nearest.type === 'scooter') {
nearest.interact(this.scene.player);
}
else if (nearest.lootTable) {
// It's a chest!
nearest.interact(this.scene.player);
}
else if (nearest.type === 'zombie') {
// Always Tame on E key (Combat is Space/Click)
nearest.tame();