diff --git a/src/scenes/ShipDeckScene.js b/src/scenes/ShipDeckScene.js index 7369c32..d9894ed 100644 --- a/src/scenes/ShipDeckScene.js +++ b/src/scenes/ShipDeckScene.js @@ -40,9 +40,21 @@ export default class ShipDeckScene extends Phaser.Scene { } createDeck() { + // Ship deck dimensions + this.deckCenterX = 400; + this.deckWidth = 700; + this.deckTopY = 200; + this.deckPlankSpacing = 30; + this.deckPlankCount = 8; + + // Calculate deck boundaries + this.deckLeftX = this.deckCenterX - this.deckWidth / 2; + this.deckRightX = this.deckCenterX + this.deckWidth / 2; + this.deckBottomY = this.deckTopY + (this.deckPlankCount - 1) * this.deckPlankSpacing; + // Ship deck planks - for (let i = 0; i < 8; i++) { - this.add.rectangle(400, 200 + i * 30, 700, 25, 0x654321) + for (let i = 0; i < this.deckPlankCount; i++) { + this.add.rectangle(this.deckCenterX, this.deckTopY + i * this.deckPlankSpacing, this.deckWidth, 25, 0x654321) .setStrokeStyle(2, 0x3d2817); } } @@ -83,8 +95,9 @@ export default class ShipDeckScene extends Phaser.Scene { const barrelCount = Math.ceil(this.inventory.fuel / 10); if (barrelCount === 0) return; - const baseX = 120; - const baseY = 450; + // Position relative to deck + const baseX = this.deckLeftX + 70; + const baseY = this.deckBottomY + 40; const barrelWidth = 50; const barrelHeight = 70; const horizontalSpacing = 60; @@ -130,8 +143,9 @@ export default class ShipDeckScene extends Phaser.Scene { const barrelCount = Math.ceil(this.inventory.whaleOil / 10); if (barrelCount === 0) return; - const baseX = 380; - const baseY = 450; + // Position relative to deck + const baseX = this.deckCenterX + 30; + const baseY = this.deckBottomY + 40; const barrelWidth = 50; const barrelHeight = 70; const horizontalSpacing = 60;