Center barrel groups vertically on deck
- Calculate total height of each barrel group - Position groups at vertical center of deck - Both fuel and oil barrels now centered vertically - More balanced visual 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:
@@ -101,11 +101,18 @@ export default class ShipDeckScene extends Phaser.Scene {
|
||||
const verticalSpacing = 75;
|
||||
const barrelsPerRow = 5;
|
||||
|
||||
// Calculate group width and center it in left half of deck
|
||||
// Calculate group dimensions
|
||||
const groupWidth = (Math.min(barrelCount, barrelsPerRow) * horizontalSpacing);
|
||||
const stackLevels = Math.ceil(barrelCount / barrelsPerRow);
|
||||
const groupHeight = (stackLevels * barrelHeight) + ((stackLevels - 1) * (verticalSpacing - barrelHeight));
|
||||
|
||||
// Center horizontally in left half of deck
|
||||
const leftHalfCenter = this.deckLeftX + (this.deckWidth / 4);
|
||||
const baseX = leftHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
||||
const baseY = this.deckBottomY - 10;
|
||||
|
||||
// Center vertically on deck
|
||||
const deckVerticalCenter = this.deckTopY + ((this.deckBottomY - this.deckTopY) / 2);
|
||||
const baseY = deckVerticalCenter + (groupHeight / 2);
|
||||
|
||||
// Create barrels in stacking pattern
|
||||
for (let i = 0; i < barrelCount; i++) {
|
||||
@@ -152,11 +159,18 @@ export default class ShipDeckScene extends Phaser.Scene {
|
||||
const verticalSpacing = 75;
|
||||
const barrelsPerRow = 3;
|
||||
|
||||
// Calculate group width and center it in right half of deck
|
||||
// Calculate group dimensions
|
||||
const groupWidth = (Math.min(barrelCount, barrelsPerRow) * horizontalSpacing);
|
||||
const stackLevels = Math.ceil(barrelCount / barrelsPerRow);
|
||||
const groupHeight = (stackLevels * barrelHeight) + ((stackLevels - 1) * (verticalSpacing - barrelHeight));
|
||||
|
||||
// Center horizontally in right half of deck
|
||||
const rightHalfCenter = this.deckCenterX + (this.deckWidth / 4);
|
||||
const baseX = rightHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
||||
const baseY = this.deckBottomY - 10;
|
||||
|
||||
// Center vertically on deck
|
||||
const deckVerticalCenter = this.deckTopY + ((this.deckBottomY - this.deckTopY) / 2);
|
||||
const baseY = deckVerticalCenter + (groupHeight / 2);
|
||||
|
||||
// Create barrels in stacking pattern
|
||||
for (let i = 0; i < barrelCount; i++) {
|
||||
|
||||
Reference in New Issue
Block a user