From 9735b1948f020ba0765af96170416d534deb104c Mon Sep 17 00:00:00 2001 From: Admin Date: Sat, 19 Sep 2026 06:25:49 +0000 Subject: [PATCH] fix: sync isolated atlas frames and terrain seams --- src/main.js | 80 +++++++++++++++++++++++++---------------------------- 1 file changed, 38 insertions(+), 42 deletions(-) diff --git a/src/main.js b/src/main.js index 236ee40..27b2c21 100644 --- a/src/main.js +++ b/src/main.js @@ -109,47 +109,43 @@ class ForestScene extends Phaser.Scene { }; [ - ['idle0', 0, 70, 145, 185], - ['idle1', 130, 70, 150, 185], - ['idle2', 260, 70, 150, 185], - ['idle3', 385, 70, 170, 185], - ['run0', 575, 75, 165, 180], - ['run1', 715, 75, 165, 180], - ['run2', 855, 75, 165, 180], - ['run3', 995, 75, 165, 180], - ['run4', 1130, 75, 175, 180], - ['run5', 1270, 75, 178, 180], - ['jump0', 0, 315, 190, 195], - ['jump1', 175, 315, 200, 195], - ['fall0', 470, 315, 170, 195], - ['fall1', 625, 315, 175, 195], - ['land0', 955, 325, 225, 185], - ['land1', 1185, 325, 205, 185] + ['idle0', 15, 87, 134, 153], + ['idle1', 148, 91, 129, 150], + ['idle2', 269, 90, 127, 151], + ['idle3', 393, 86, 153, 154], + ['run0', 607, 101, 148, 139], + ['run5', 1286, 105, 147, 135], + ['jump0', 23, 355, 172, 140], + ['jump1', 187, 328, 176, 146], + ['fall0', 496, 330, 134, 161], + ['fall1', 643, 325, 135, 167], + ['land0', 982, 345, 194, 146], + ['land1', 1203, 348, 163, 144] ].forEach(([name, x, y, w, h]) => addFrame('player-sheet', name, x, y, w, h)); - addFrame('terrain-sheet', 'ground-main', 10, 18, 500, 132); - addFrame('terrain-sheet', 'log-platform', 10, 315, 290, 105); - addFrame('terrain-sheet', 'root-platform', 995, 650, 430, 205); + addFrame('terrain-sheet', 'ground-main', 24, 32, 341, 107); + addFrame('terrain-sheet', 'log-platform', 21, 327, 269, 79); + addFrame('terrain-sheet', 'root-platform', 1023, 672, 402, 168); - addFrame('flora-sheet', 'bush', 5, 18, 260, 165); - addFrame('flora-sheet', 'fern-cluster', 450, 0, 390, 180); - addFrame('flora-sheet', 'bluebells', 0, 170, 365, 150); - addFrame('flora-sheet', 'mush-red', 0, 310, 185, 220); - addFrame('flora-sheet', 'mush-brown', 370, 310, 215, 220); - addFrame('flora-sheet', 'mush-orange', 545, 315, 145, 215); - addFrame('flora-sheet', 'mush-purple', 670, 310, 210, 220); - addFrame('flora-sheet', 'mush-blue', 930, 310, 310, 220); - addFrame('flora-sheet', 'acorn-art', 10, 525, 90, 120); + addFrame('flora-sheet', 'bush', 16, 28, 244, 149); + addFrame('flora-sheet', 'fern-cluster', 659, 19, 169, 154); + addFrame('flora-sheet', 'bluebells', 15, 180, 100, 131); + addFrame('flora-sheet', 'mush-red', 14, 321, 168, 200); + addFrame('flora-sheet', 'mush-brown', 388, 328, 195, 195); + addFrame('flora-sheet', 'mush-orange', 560, 335, 117, 184); + addFrame('flora-sheet', 'mush-purple', 685, 331, 114, 188); + addFrame('flora-sheet', 'mush-blue', 1088, 336, 149, 186); + addFrame('flora-sheet', 'acorn-art', 178, 567, 58, 71); const frogFrames = [ - [40, 500, 165, 150], [200, 500, 190, 150], [390, 500, 190, 150], - [570, 500, 220, 150], [810, 500, 175, 150] + [72, 538, 99, 88], [231, 537, 105, 89], [422, 535, 155, 96], + [594, 505, 169, 95], [845, 547, 118, 79] ]; frogFrames.forEach(([x, y, w, h], i) => addFrame('fauna-sheet', `frog${i}`, x, y, w, h)); const hedgehogFrames = [ - [0, 45, 155, 145], [145, 45, 155, 145], [285, 45, 160, 145], - [425, 45, 160, 145], [565, 45, 160, 145], [700, 45, 155, 145] + [18, 66, 139, 106], [169, 64, 131, 108], [310, 63, 131, 105], + [449, 66, 129, 107], [592, 57, 120, 115], [729, 67, 105, 105] ]; hedgehogFrames.forEach(([x, y, w, h], i) => addFrame('fauna-sheet', `hedgehog${i}`, x, y, w, h)); } @@ -166,8 +162,8 @@ class ForestScene extends Phaser.Scene { this.anims.create({ key: 'squirrel-run', - frames: frames('player-sheet', ['run0', 'run1', 'run2', 'run3', 'run4', 'run5']), - frameRate: 12, + frames: frames('player-sheet', ['run0', 'run5']), + frameRate: 7, repeat: -1 }); @@ -369,10 +365,10 @@ class ForestScene extends Phaser.Scene { this.physics.add.existing(ground, true); this.platforms.add(ground); - for (let x = 215; x < WORLD_WIDTH + 220; x += 430) { + for (let x = 165; x < WORLD_WIDTH + 340; x += 320) { this.add.image(x, GROUND_Y - 5, 'terrain-sheet', 'ground-main') .setOrigin(0.5, 0) - .setScale(0.9) + .setScale(0.98) .setDepth(3); } @@ -454,12 +450,12 @@ class ForestScene extends Phaser.Scene { createPlayer() { this.player = this.physics.add.sprite(160, 520, 'player-sheet', 'idle0'); - this.player.setScale(0.5); + this.player.setScale(0.58); this.player.setCollideWorldBounds(true); this.player.setDragX(900); this.player.setMaxVelocity(330, 760); - this.player.body.setSize(64, 105, true); - this.player.body.setOffset(40, 62); + this.player.body.setSize(58, 88, true); + this.player.body.setOffset(38, 54); this.player.play('squirrel-idle'); } @@ -473,9 +469,9 @@ class ForestScene extends Phaser.Scene { [4470, 555], [4680, 460], [4910, 555], [5100, 370] ].forEach(([x, y], i) => { const acorn = this.acornGroup.create(x, y, 'flora-sheet', 'acorn-art'); - acorn.setScale(0.42); + acorn.setScale(0.62); acorn.setBounce(0.2); - acorn.body.setSize(55, 70, true); + acorn.body.setSize(38, 48, true); acorn.setData('phase', i * 0.4); }); @@ -490,7 +486,7 @@ class ForestScene extends Phaser.Scene { mushrooms.forEach(([x, y, frame, name], index) => { const mushroom = this.mushroomGroup.create(x, y, 'flora-sheet', frame); - const scale = frame === 'mush-blue' ? 0.2 : 0.24; + const scale = frame === 'mush-blue' ? 0.3 : 0.28; mushroom.setScale(scale); mushroom.setData('name', name); mushroom.setBounce(0.1);