diff --git a/src/main.js b/src/main.js
index 45687c1..f50d45e 100644
--- a/src/main.js
+++ b/src/main.js
@@ -71,7 +71,10 @@ const FLOOR_H = Math.floor(
) / FLOOR_COUNT
)
const STATUS_Y = HEIGHT - 36
-const ELEVATOR_CAR_H = Math.min(140, Math.max(76, Math.round(FLOOR_H * 0.58)))
+const ELEVATOR_CAR_W = 82
+const ELEVATOR_CAR_H = Math.min(104, Math.max(74, Math.round(FLOOR_H * 0.36)))
+const ELEVATOR_OPENING_W = 72
+const ELEVATOR_OPENING_H = Math.min(96, Math.max(68, Math.round(FLOOR_H * 0.34)))
const PLAYER_DRAG_FOLLOW = 0.18
const PLAYER_DRAG_OFFSET_Y = 42
@@ -179,26 +182,66 @@ function cropTexture(scene, sourceKey, key, rect) {
scene.textures.addCanvas(key, canvas)
}
-const ELEVATOR_SVG = `
-
-`
+function buildElevatorSvg() {
+ const shaftHeight = FLOOR_COUNT * FLOOR_H + (FLOOR_COUNT - 1) * FLOOR_GAP
+ const openings = Array.from({ length: FLOOR_COUNT }, (_, floor) => {
+ const centerY = floor * (FLOOR_H + FLOOR_GAP) + FLOOR_H / 2
+ const y = centerY - ELEVATOR_OPENING_H / 2
+
+ return `
+
+ ♥
+ `
+ }).join('')
+
+ return `
+
+ `
+}
class HouseScene extends Phaser.Scene {
constructor() {
@@ -226,7 +269,7 @@ class HouseScene extends Phaser.Scene {
this.load.image('character-sheet', '/assets/character-sheet.png')
this.load.image(
'elevator-shaft',
- 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(ELEVATOR_SVG)
+ 'data:image/svg+xml;charset=utf-8,' + encodeURIComponent(buildElevatorSvg())
)
}
@@ -319,15 +362,16 @@ class HouseScene extends Phaser.Scene {
const stopY = elevatorStopY(currentRoom)
const cx = ELEVATOR_X + ELEVATOR_W / 2
- this.elevatorCarBack = this.add.rectangle(cx, stopY, 94, ELEVATOR_CAR_H, 0xfff8fb, 1)
+ this.elevatorCarBack = this.add.rectangle(cx, stopY, ELEVATOR_CAR_W, ELEVATOR_CAR_H, 0xfff8fb, 1)
.setStrokeStyle(3, 0xb98ba2)
.setDepth(190)
- this.elevatorDoorLeft = this.add.rectangle(cx - 23, stopY, 44, ELEVATOR_CAR_H - 8, 0xf4bfd2, 1)
+ const doorW = Math.floor((ELEVATOR_CAR_W - 6) / 2)
+ this.elevatorDoorLeft = this.add.rectangle(cx - doorW / 2, stopY, doorW, ELEVATOR_CAR_H - 8, 0xf4bfd2, 1)
.setStrokeStyle(2, 0xc17d9d)
.setDepth(210)
- this.elevatorDoorRight = this.add.rectangle(cx + 23, stopY, 44, ELEVATOR_CAR_H - 8, 0xf4bfd2, 1)
+ this.elevatorDoorRight = this.add.rectangle(cx + doorW / 2, stopY, doorW, ELEVATOR_CAR_H - 8, 0xf4bfd2, 1)
.setStrokeStyle(2, 0xc17d9d)
.setDepth(210)
@@ -630,8 +674,11 @@ class HouseScene extends Phaser.Scene {
async setElevatorDoors(open) {
const cx = ELEVATOR_X + ELEVATOR_W / 2
- const leftX = open ? cx - 58 : cx - 23
- const rightX = open ? cx + 58 : cx + 23
+ const doorW = Math.floor((ELEVATOR_CAR_W - 6) / 2)
+ const closedOffset = doorW / 2
+ const openOffset = ELEVATOR_CAR_W / 2 + doorW / 2 + 4
+ const leftX = open ? cx - openOffset : cx - closedOffset
+ const rightX = open ? cx + openOffset : cx + closedOffset
await Promise.all([
this.tweenAsync({
@@ -934,7 +981,7 @@ const game = new Phaser.Game({
})
window.__DOLLHOUSE__ = {
- version: '0.4.2',
+ version: '0.4.3',
game,
async resetAll() {
await clearGameState()