Center barrel groups within their deck sections

- Calculate total width of each barrel group
- Center fuel barrels in left quarter of deck
- Center oil barrels in right quarter of deck
- More balanced and symmetrical layout

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
Thomas Richter
2025-12-17 04:00:32 +01:00
parent 7e0a4f4e19
commit b1db1c1402

View File

@@ -95,15 +95,18 @@ export default class ShipDeckScene extends Phaser.Scene {
const barrelCount = Math.ceil(this.inventory.fuel / 10);
if (barrelCount === 0) return;
// Position relative to deck
const baseX = this.deckLeftX + 70;
const baseY = this.deckBottomY + 40;
const barrelWidth = 50;
const barrelHeight = 70;
const horizontalSpacing = 60;
const verticalSpacing = 75;
const barrelsPerRow = 5;
// Calculate group width and center it in left half of deck
const groupWidth = (Math.min(barrelCount, barrelsPerRow) * horizontalSpacing);
const leftHalfCenter = this.deckLeftX + (this.deckWidth / 4);
const baseX = leftHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
const baseY = this.deckBottomY + 40;
// Create barrels in stacking pattern
for (let i = 0; i < barrelCount; i++) {
const row = i % barrelsPerRow;
@@ -143,15 +146,18 @@ export default class ShipDeckScene extends Phaser.Scene {
const barrelCount = Math.ceil(this.inventory.whaleOil / 10);
if (barrelCount === 0) return;
// Position relative to deck
const baseX = this.deckCenterX + 30;
const baseY = this.deckBottomY + 40;
const barrelWidth = 50;
const barrelHeight = 70;
const horizontalSpacing = 60;
const verticalSpacing = 75;
const barrelsPerRow = 3;
// Calculate group width and center it in right half of deck
const groupWidth = (Math.min(barrelCount, barrelsPerRow) * horizontalSpacing);
const rightHalfCenter = this.deckCenterX + (this.deckWidth / 4);
const baseX = rightHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
const baseY = this.deckBottomY + 40;
// Create barrels in stacking pattern
for (let i = 0; i < barrelCount; i++) {
const row = i % barrelsPerRow;