mirror of
https://github.com/cliffe/BreakEscape.git
synced 2026-02-22 11:48:18 +00:00
fix: Adjust east/west door positioning for consistent alignment and visual display
This commit is contained in:
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user