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:
@@ -95,15 +95,18 @@ export default class ShipDeckScene extends Phaser.Scene {
|
|||||||
const barrelCount = Math.ceil(this.inventory.fuel / 10);
|
const barrelCount = Math.ceil(this.inventory.fuel / 10);
|
||||||
if (barrelCount === 0) return;
|
if (barrelCount === 0) return;
|
||||||
|
|
||||||
// Position relative to deck
|
|
||||||
const baseX = this.deckLeftX + 70;
|
|
||||||
const baseY = this.deckBottomY + 40;
|
|
||||||
const barrelWidth = 50;
|
const barrelWidth = 50;
|
||||||
const barrelHeight = 70;
|
const barrelHeight = 70;
|
||||||
const horizontalSpacing = 60;
|
const horizontalSpacing = 60;
|
||||||
const verticalSpacing = 75;
|
const verticalSpacing = 75;
|
||||||
const barrelsPerRow = 5;
|
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
|
// Create barrels in stacking pattern
|
||||||
for (let i = 0; i < barrelCount; i++) {
|
for (let i = 0; i < barrelCount; i++) {
|
||||||
const row = i % barrelsPerRow;
|
const row = i % barrelsPerRow;
|
||||||
@@ -143,15 +146,18 @@ export default class ShipDeckScene extends Phaser.Scene {
|
|||||||
const barrelCount = Math.ceil(this.inventory.whaleOil / 10);
|
const barrelCount = Math.ceil(this.inventory.whaleOil / 10);
|
||||||
if (barrelCount === 0) return;
|
if (barrelCount === 0) return;
|
||||||
|
|
||||||
// Position relative to deck
|
|
||||||
const baseX = this.deckCenterX + 30;
|
|
||||||
const baseY = this.deckBottomY + 40;
|
|
||||||
const barrelWidth = 50;
|
const barrelWidth = 50;
|
||||||
const barrelHeight = 70;
|
const barrelHeight = 70;
|
||||||
const horizontalSpacing = 60;
|
const horizontalSpacing = 60;
|
||||||
const verticalSpacing = 75;
|
const verticalSpacing = 75;
|
||||||
const barrelsPerRow = 3;
|
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
|
// Create barrels in stacking pattern
|
||||||
for (let i = 0; i < barrelCount; i++) {
|
for (let i = 0; i < barrelCount; i++) {
|
||||||
const row = i % barrelsPerRow;
|
const row = i % barrelsPerRow;
|
||||||
|
|||||||
Reference in New Issue
Block a user