From 6133020a60b835d3ae97280158a408580dbaf886 Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 19 Sep 2026 07:58:10 +0000 Subject: [PATCH] fix: sync ground art collision alignment --- src/main.js | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/src/main.js b/src/main.js index af4fa15..7df43d6 100644 --- a/src/main.js +++ b/src/main.js @@ -4,6 +4,9 @@ import './style.css'; const WORLD_WIDTH = 5600; const WORLD_HEIGHT = 720; const GROUND_Y = 628; +const GROUND_SURFACE_Y = GROUND_Y - 4; +const GROUND_ART_SCALE = 0.98; +const GROUND_ART_SURFACE_OFFSET = 20; class ForestScene extends Phaser.Scene { constructor() { @@ -364,14 +367,25 @@ class ForestScene extends Phaser.Scene { createWorld() { this.platforms = this.physics.add.staticGroup(); - const ground = this.add.rectangle(WORLD_WIDTH / 2, GROUND_Y + 46, WORLD_WIDTH, 100, 0x263c2d, 0); + // Keep the physics plane and the illustrated grass line on the exact same Y. + // In ground-main the continuous walkable grass line is 20 source pixels + // below the cropped frame top. + const ground = this.add.rectangle( + WORLD_WIDTH / 2, + GROUND_SURFACE_Y + 50, + WORLD_WIDTH, + 100, + 0x263c2d, + 0 + ); this.physics.add.existing(ground, true); this.platforms.add(ground); + const groundArtY = GROUND_SURFACE_Y - (GROUND_ART_SURFACE_OFFSET * GROUND_ART_SCALE); for (let x = 165; x < WORLD_WIDTH + 340; x += 320) { - this.add.image(x, GROUND_Y - 5, 'terrain-sheet', 'ground-main') + this.add.image(x, groundArtY, 'terrain-sheet', 'ground-main') .setOrigin(0.5, 0) - .setScale(0.98) + .setScale(GROUND_ART_SCALE) .setDepth(3); }