Update barrel centering to use actual deck edges
- Store deckTopEdge and deckBottomEdge as properties - Use these edges for barrel vertical centering - Barrels now align with border dimensions - Both fuel and oil barrels properly centered 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -58,12 +58,12 @@ export default class ShipDeckScene extends Phaser.Scene {
|
|||||||
.setStrokeStyle(2, 0x3d2817);
|
.setStrokeStyle(2, 0x3d2817);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw border around deck
|
// Calculate actual deck edges (including plank height)
|
||||||
const plankHeight = 25;
|
const plankHeight = 25;
|
||||||
const deckTopEdge = this.deckTopY - (plankHeight / 2);
|
this.deckTopEdge = this.deckTopY - (plankHeight / 2);
|
||||||
const deckBottomEdge = this.deckBottomY + (plankHeight / 2);
|
this.deckBottomEdge = this.deckBottomY + (plankHeight / 2);
|
||||||
const deckHeight = deckBottomEdge - deckTopEdge;
|
const deckHeight = this.deckBottomEdge - this.deckTopEdge;
|
||||||
const deckCenterY = (deckTopEdge + deckBottomEdge) / 2;
|
const deckCenterY = (this.deckTopEdge + this.deckBottomEdge) / 2;
|
||||||
|
|
||||||
const deckBorder = this.add.rectangle(this.deckCenterX, deckCenterY, this.deckWidth, deckHeight);
|
const deckBorder = this.add.rectangle(this.deckCenterX, deckCenterY, this.deckWidth, deckHeight);
|
||||||
deckBorder.setStrokeStyle(4, 0x3d2817);
|
deckBorder.setStrokeStyle(4, 0x3d2817);
|
||||||
@@ -121,8 +121,8 @@ export default class ShipDeckScene extends Phaser.Scene {
|
|||||||
const leftHalfCenter = this.deckLeftX + (this.deckWidth / 4);
|
const leftHalfCenter = this.deckLeftX + (this.deckWidth / 4);
|
||||||
const baseX = leftHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
const baseX = leftHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
||||||
|
|
||||||
// Center vertically on deck
|
// Center vertically on deck (using actual deck edges)
|
||||||
const deckVerticalCenter = this.deckTopY + ((this.deckBottomY - this.deckTopY) / 2);
|
const deckVerticalCenter = (this.deckTopEdge + this.deckBottomEdge) / 2;
|
||||||
const baseY = deckVerticalCenter + (groupHeight / 2);
|
const baseY = deckVerticalCenter + (groupHeight / 2);
|
||||||
|
|
||||||
// Create barrels in stacking pattern
|
// Create barrels in stacking pattern
|
||||||
@@ -179,8 +179,8 @@ export default class ShipDeckScene extends Phaser.Scene {
|
|||||||
const rightHalfCenter = this.deckCenterX + (this.deckWidth / 4);
|
const rightHalfCenter = this.deckCenterX + (this.deckWidth / 4);
|
||||||
const baseX = rightHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
const baseX = rightHalfCenter - (groupWidth / 2) + (horizontalSpacing / 2);
|
||||||
|
|
||||||
// Center vertically on deck
|
// Center vertically on deck (using actual deck edges)
|
||||||
const deckVerticalCenter = this.deckTopY + ((this.deckBottomY - this.deckTopY) / 2);
|
const deckVerticalCenter = (this.deckTopEdge + this.deckBottomEdge) / 2;
|
||||||
const baseY = deckVerticalCenter + (groupHeight / 2);
|
const baseY = deckVerticalCenter + (groupHeight / 2);
|
||||||
|
|
||||||
// Create barrels in stacking pattern
|
// Create barrels in stacking pattern
|
||||||
|
|||||||
Reference in New Issue
Block a user