From 09cd416d02687c1fbb114f2efad851c47a226898 Mon Sep 17 00:00:00 2001 From: "Z. Cliffe Schreuders" Date: Mon, 17 Nov 2025 15:48:36 +0000 Subject: [PATCH] fix: Adjust east/west door positioning for consistent alignment and visual display --- js/systems/collision.js | 12 ++++++------ js/systems/doors.js | 14 ++++++++------ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/js/systems/collision.js b/js/systems/collision.js index 2b931b6..8b96d45 100644 --- a/js/systems/collision.js +++ b/js/systems/collision.js @@ -369,18 +369,18 @@ export function removeWallTilesForDoorInRoom(roomId, fromRoomId, direction, door doorWidth = TILE_SIZE * 2; doorHeight = TILE_SIZE; } else if (direction === 'east' || direction === 'west') { - // For east/west connections: positioned 3 tiles down from top corner - // Passage cutout is 3 tiles wide vertically - doorY = roomPosition.y + (TILE_SIZE * 3); // 3 tiles from top corner + // For east/west connections: positioned at Y center, 1 tile from the edge + // Passage cutout is 1 tile wide (horizontally) and 3 tiles tall (vertically) + doorY = roomPosition.y + (TILE_SIZE * 2.5); // Center of the 3-tile passage if (direction === 'east') { // Original door is east, so new door should be west - doorX = roomPosition.x + TILE_SIZE; + doorX = roomPosition.x + (TILE_SIZE / 2); } else { // Original door is west, so new door should be east - doorX = roomPosition.x + roomWidth - TILE_SIZE; + doorX = roomPosition.x + roomWidth - (TILE_SIZE / 2); } - // Side doors have a 3-tile wide passage (vertically) + // Side doors: 1 tile wide (horizontally) x 3 tiles tall (vertically) doorWidth = TILE_SIZE; doorHeight = TILE_SIZE * 3; } else { diff --git a/js/systems/doors.js b/js/systems/doors.js index 47ecad7..660b8da 100644 --- a/js/systems/doors.js +++ b/js/systems/doors.js @@ -221,7 +221,8 @@ function placeEastDoorSingle(roomId, roomPosition, roomDimensions, connectedRoom const roomWidthPx = roomDimensions.widthPx; // Use center-based positioning like N/S doors for consistency - const doorX = roomPosition.x + roomWidthPx; // 0.5 tiles from right edge (towards wall) + // Position 0.5 tiles from right edge + 0.5 tiles into room for visual positioning + const doorX = roomPosition.x + roomWidthPx - (TILE_SIZE / 2); // 0.5 tiles from right edge (towards wall) const doorY = roomPosition.y + (TILE_SIZE * 2.5); // 2.5 tiles from top corner (center of door) return { x: doorX, y: doorY, connectedRoom }; @@ -236,6 +237,7 @@ function placeEastDoorsMultiple(roomId, roomPosition, roomDimensions, connectedR const doorPositions = []; // Use center-based positioning like N/S doors for consistency + // Position 0.5 tiles from right edge for visual display (slightly into room from wall) const doorX = roomPosition.x + roomWidthPx - (TILE_SIZE / 2); // 0.5 tiles from right edge (towards wall) if (connectedRooms.length === 1) { @@ -770,15 +772,15 @@ function createAnimatedDoorOnOppositeSide(roomId, fromRoomId, direction, doorWor doorWidth = TILE_SIZE; if (direction === 'east') { - // Original door was on east side + // Original door was on east side at 0.5 tiles from right edge // Animated door stays at doorWorldX, doorWorldY - // Opposite door goes on west side of new room, next to the animated door - oppositeDoorX = roomPosition.x + (TILE_SIZE / 2) + (TILE_SIZE / 2); // 0.5 tiles from left edge + 0.5 tiles further into room + // Opposite door goes on west side of new room at 0.5 tiles from left edge + oppositeDoorX = roomPosition.x + (TILE_SIZE / 2); // 0.5 tiles from left edge oppositeDoorY = doorWorldY; // Same Y as animated door } else { - // Original door was on west side + // Original door was on west side at 0.5 tiles from left edge // Animated door stays at doorWorldX, doorWorldY - // Opposite door goes on east side of new room, next to the animated door + // Opposite door goes on east side of new room at 0.5 tiles from right edge oppositeDoorX = roomPosition.x + roomWidth - (TILE_SIZE / 2); // 0.5 tiles from right edge oppositeDoorY = doorWorldY; // Same Y as animated door }