Implement tile discarding, blocked doors, and correct corridor exits
- Updated TileDefinitions.js: Added 4-way exits to corridor_straight and corridor_steps (N/S y=3,4; E/W x=3,4). - Updated DungeonGenerator.js: Added cancelPlacement() logic and onDoorBlocked callback. - Updated GameRenderer.js: Implemented blockDoor() to visualize blocked passages, and improved isPlayerAdjacentToDoor. - Updated UIManager.js: Added custom showModal/showConfirm and Discard button for tile placement. - Updated main.js: Handled blocked door clicks and hooked up UI events. - Updated GameEngine.js: Improved door adjacency checks. - Updated CameraManager.js: Preserved camera rotation on centerOn. - Added door1_blocked.png asset.
This commit is contained in:
@@ -52,9 +52,14 @@ export class CameraManager {
|
||||
}
|
||||
|
||||
centerOn(x, y) {
|
||||
// Grid (x, y) -> World (x, 0, -y)
|
||||
// Calculate current offset relative to OLD target
|
||||
const currentOffset = this.camera.position.clone().sub(this.target);
|
||||
|
||||
// Update target: Grid (x, y) -> World (x, 0, -y)
|
||||
this.target.set(x, 0, -y);
|
||||
this.camera.position.copy(this.target).add(this.isoOffset);
|
||||
|
||||
// Restore position with new target + same relative offset
|
||||
this.camera.position.copy(this.target).add(currentOffset);
|
||||
this.camera.lookAt(this.target);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user