Make existing roof visitable without garden overlay
This commit is contained in:
parent
0aa3fc8928
commit
6188db9e13
116
src/main.js
116
src/main.js
@ -68,13 +68,13 @@ const STATUS_Y = 1538
|
||||
|
||||
// A true rooftop level above the shell, rather than a tiny room inside the gable.
|
||||
const ROOF_ROOM_BOUNDS = {
|
||||
x: 155,
|
||||
y: 42,
|
||||
width: 812,
|
||||
height: 168
|
||||
x: 96,
|
||||
y: HOUSE_Y_OFFSET + 34,
|
||||
width: 930,
|
||||
height: 174
|
||||
}
|
||||
|
||||
const ROOF_LIFT_STOP_Y = ROOF_ROOM_BOUNDS.y + ROOF_ROOM_BOUNDS.height - 24
|
||||
const ROOF_LIFT_STOP_Y = ROOF_ROOM_BOUNDS.y + ROOF_ROOM_BOUNDS.height - 28
|
||||
const ELEVATOR_SHAFT_TOP = ROOF_LIFT_STOP_Y - 48
|
||||
|
||||
const ELEVATOR_CAR_W = 82
|
||||
@ -189,7 +189,7 @@ function makeRoofRoom() {
|
||||
|
||||
return {
|
||||
id: 'roof-garden',
|
||||
name: 'Rooftop Garden',
|
||||
name: 'Roof',
|
||||
floor: -1,
|
||||
side: 'center',
|
||||
isRoof: true,
|
||||
@ -199,7 +199,7 @@ function makeRoofRoom() {
|
||||
width,
|
||||
height,
|
||||
walkBand: {
|
||||
minY: y + Math.round(height * 0.68),
|
||||
minY: y + Math.round(height * 0.70),
|
||||
maxY: y + height - 8,
|
||||
homeY: ROOF_LIFT_STOP_Y
|
||||
}
|
||||
@ -404,7 +404,6 @@ class HouseScene extends Phaser.Scene {
|
||||
|
||||
this.drawHouse()
|
||||
this.buildHouseShell()
|
||||
this.drawRoofRoom()
|
||||
this.buildElevator()
|
||||
this.buildUi()
|
||||
this.spawnPlayer()
|
||||
@ -602,92 +601,6 @@ class HouseScene extends Phaser.Scene {
|
||||
|
||||
}
|
||||
|
||||
drawRoofRoom() {
|
||||
const room = ROOM_BY_ID.get('roof-garden')
|
||||
const graphics = this.add.graphics().setDepth(30)
|
||||
|
||||
const left = room.x
|
||||
const right = room.x + room.width
|
||||
const top = room.y
|
||||
const bottom = room.y + room.height
|
||||
const backLeft = left + 84
|
||||
const backRight = right - 84
|
||||
const horizonY = room.walkBand.minY
|
||||
|
||||
// Open rooftop terrace. The transparent sky lets the pink roof remain
|
||||
// visible behind it while the green deck makes the playable level obvious.
|
||||
graphics.fillStyle(0xffffff, 0.72)
|
||||
graphics.fillRoundedRect(left, top, room.width, room.height, 24)
|
||||
|
||||
graphics.fillStyle(0x94d985, 1)
|
||||
graphics.fillPoints([
|
||||
new Phaser.Geom.Point(backLeft, horizonY),
|
||||
new Phaser.Geom.Point(backRight, horizonY),
|
||||
new Phaser.Geom.Point(right - 18, bottom - 8),
|
||||
new Phaser.Geom.Point(left + 18, bottom - 8)
|
||||
], true)
|
||||
|
||||
// Pink rooftop railing.
|
||||
graphics.lineStyle(6, 0xf3a7c1, 1)
|
||||
graphics.lineBetween(left + 24, horizonY - 22, right - 24, horizonY - 22)
|
||||
graphics.lineBetween(left + 28, horizonY - 22, left + 28, bottom - 10)
|
||||
graphics.lineBetween(right - 28, horizonY - 22, right - 28, bottom - 10)
|
||||
|
||||
// Planters along the back edge.
|
||||
graphics.fillStyle(0xf2c08d, 1)
|
||||
graphics.fillRoundedRect(left + 56, horizonY - 27, 104, 22, 6)
|
||||
graphics.fillRoundedRect(right - 160, horizonY - 27, 104, 22, 6)
|
||||
|
||||
const flowers = [
|
||||
{ x: left + 78, y: horizonY - 37, color: '#ff7fa9' },
|
||||
{ x: left + 104, y: horizonY - 43, color: '#ffd86a' },
|
||||
{ x: left + 132, y: horizonY - 36, color: '#b78cff' },
|
||||
{ x: right - 132, y: horizonY - 36, color: '#ff8f7e' },
|
||||
{ x: right - 104, y: horizonY - 44, color: '#ffd86a' },
|
||||
{ x: right - 78, y: horizonY - 38, color: '#b78cff' }
|
||||
]
|
||||
|
||||
flowers.forEach((flower) => {
|
||||
this.add.text(flower.x, flower.y, '✿', {
|
||||
fontFamily: 'Arial',
|
||||
fontSize: '23px',
|
||||
color: flower.color
|
||||
}).setOrigin(0.5).setDepth(32)
|
||||
})
|
||||
|
||||
// Bench on the left, keeping the lift landing clear in the centre/right.
|
||||
graphics.fillStyle(0xe3b47c, 1)
|
||||
graphics.fillRoundedRect(left + 218, horizonY - 12, 112, 12, 5)
|
||||
graphics.fillRect(left + 230, horizonY, 7, 20)
|
||||
graphics.fillRect(left + 309, horizonY, 7, 20)
|
||||
|
||||
// Lift landing marker aligned with the real sixth elevator stop.
|
||||
graphics.fillStyle(0xfff2f7, 1)
|
||||
graphics.fillRoundedRect(TOWER_CENTER_X - 56, horizonY - 38, 112, 44, 10)
|
||||
graphics.lineStyle(4, 0xd99ab6, 1)
|
||||
graphics.strokeRoundedRect(TOWER_CENTER_X - 56, horizonY - 38, 112, 44, 10)
|
||||
|
||||
graphics.lineStyle(4, 0xd5a4bd, 1)
|
||||
graphics.strokeRoundedRect(left, top, room.width, room.height, 24)
|
||||
|
||||
this.add.text(left + 20, top + 14, 'Rooftop Garden', {
|
||||
fontFamily: 'Arial Rounded MT Bold, ui-rounded, sans-serif',
|
||||
fontSize: '19px',
|
||||
color: '#56734e',
|
||||
fontStyle: 'bold',
|
||||
backgroundColor: 'rgba(255,255,255,0.90)',
|
||||
padding: { x: 8, y: 4 }
|
||||
}).setDepth(33)
|
||||
|
||||
this.add.text(right - 22, top + 17, 'hold to visit', {
|
||||
fontFamily: 'Arial Rounded MT Bold, ui-rounded, sans-serif',
|
||||
fontSize: '14px',
|
||||
color: '#8b6577',
|
||||
backgroundColor: 'rgba(255,255,255,0.86)',
|
||||
padding: { x: 6, y: 3 }
|
||||
}).setOrigin(1, 0).setDepth(33)
|
||||
}
|
||||
|
||||
buildHouseShell() {
|
||||
const shellDepth = 7
|
||||
const towerDepth = 8
|
||||
@ -759,17 +672,6 @@ class HouseScene extends Phaser.Scene {
|
||||
.setDisplaySize(ELEVATOR_W, shaftHeight)
|
||||
.setDepth(20)
|
||||
|
||||
this.add.rectangle(
|
||||
ELEVATOR_X + ELEVATOR_W / 2,
|
||||
ROOF_LIFT_STOP_Y,
|
||||
ELEVATOR_W + 18,
|
||||
ELEVATOR_OPENING_H + 20,
|
||||
0xfff4f8,
|
||||
0.96
|
||||
)
|
||||
.setStrokeStyle(4, 0xd8a2b9)
|
||||
.setDepth(18)
|
||||
|
||||
const currentRoom = this.currentRoom()
|
||||
const stopY = elevatorStopY(currentRoom)
|
||||
const cx = ELEVATOR_X + ELEVATOR_W / 2
|
||||
@ -1068,7 +970,7 @@ class HouseScene extends Phaser.Scene {
|
||||
)
|
||||
|
||||
if (room.isRoof) {
|
||||
this.player.setScale(Phaser.Math.Linear(0.20, 0.24, t))
|
||||
this.player.setScale(Phaser.Math.Linear(0.24, 0.29, t))
|
||||
this.player.setDepth(299)
|
||||
return
|
||||
}
|
||||
@ -1401,7 +1303,7 @@ const game = new Phaser.Game({
|
||||
})
|
||||
|
||||
window.__DOLLHOUSE__ = {
|
||||
version: '0.10.7',
|
||||
version: '0.10.8',
|
||||
game,
|
||||
async resetAll() {
|
||||
await clearGameState()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user