From 7e0a4f4e193a183ea1e895a468b9c1ea3fdb1a09 Mon Sep 17 00:00:00 2001 From: Thomas Richter Date: Wed, 17 Dec 2025 03:58:22 +0100 Subject: [PATCH] Position barrels relative to deck dimensions MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Store deck dimensions as properties - Calculate deck boundaries (left, right, top, bottom) - Position fuel barrels relative to deck left edge - Position oil barrels relative to deck center - Both positioned relative to deck bottom 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 --- src/scenes/ShipDeckScene.js | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) 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;